Reputation: 186
Why is the path for sourceSets.generated.java.srcDirs "generated-src/antlr/main" and not "generated-src/antlr"?
From the documentation, it seems that the standard way of declaring a srcDir is to exclude the sourceSet name, for example:
sourceSets {
main {
java {
srcDirs = ['src/java']
}
resources {
srcDirs = ['src/resources']
}
}
}
Any help is greatly appreciated.
Cheers.
Upvotes: 0
Views: 12353
Reputation: 14500
The Gradle Java plugin convention is to place source sets file as follows: src/<sourceSetName>/<type>
That means src/main/java
for the main Java files of a module, src/test/groovy
for the Groovy test files, etc ...
As you can see from the example I gave, that convention is also respected by other plugins, Groovy, Scala, Kotlin, ...
Note that in the project above, locating the generated files inside the build
directory would be better aligned with Gradle conventions as it would alleviate the need for modifying the clean
task.
Upvotes: 0