Reputation: 5232
Is there a way to convince Gradle to accept resource files (like XML files) as well in the src/main/java
folder?
This would be great since I need to put my JavaFX XML files there ...
Upvotes: 4
Views: 1754
Reputation: 14943
The equivalent Kotlin DSL would be:
sourceSets {
main {
resources {
srcDirs("src/main/java")
include("**/*.fxml")
}
}
}
Upvotes: 0
Reputation: 27952
As the name suggests src/main/java
is for JAVA files. Whilst it's possible to tweak gradle's defaults to allow resources in this folder, you shouldn't (in my opinionated view).
I suggest you stick to the sensible conventions and put your xml etc in src/main/resources
. This convention is followed by both Maven and Gradle.
Upvotes: -2
Reputation: 23637
You could define where gradle looks for resource files by doing something like this:
sourceSets {
main {
resources {
srcDirs = ["src/main/java"]
includes = ["**/*.fxml"]
}
}
}
Upvotes: 8