I’m migrating the post from here: [#GRADLE-2726] Eclipse plugin adds only the last srcDir having the same leaf folder name of a sourceSet. because I met the similar issue today:
When I have the following sourceSets definition in my build file and I generate an eclipse plugin, only the last source entry is added as a source.
The problem looks like the srcDirs set looks only at the leaf folder which is “generated” for all the entries.
Running build from command line compiles the project successfully though.
sourceSets {
main {
java
{ srcDirs = [ 'src/generated', 'src/java/generated', 'src/somefolder/random/generated' ] }
}
Please advise
Rene
(René Groeschke)
December 4, 2015, 8:24am
2
I cannot reproduce the problem. Be aware that the eclipse plugin only adds the sourcefolders to the classpath which exist on the filesystem.
What version of Gradle are you using? I’m using version 2.4 and plugin version is 3.6.1.20140825.
To be more specific, in my case the situation happens when I Link Source from other projects so my build.gradle looks like:
sourceSets {
main {
java
{ srcDirs = [ …/‘src/generated’, "…/‘src/java/generated’, ‘…/src/somefolder/random/generated’ ] }
}
}
harks84
(Mark Harkin)
April 24, 2017, 10:31am
4
+1 this issue is still present.
My particular case was desribed in the comments of https://issues.gradle.org/browse/GRADLE-2726?_ga=1.234425630.1089073313.1485249319