Eclipse plugin adds only the last srcDir having the same leaf folder name of a sourceSet

eclipse
plugins

(Derek.YC) #1

I’m migrating the post from here: https://issues.gradle.org/browse/GRADLE-2726 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


(René Groeschke) #2

I cannot reproduce the problem. Be aware that the eclipse plugin only adds the sourcefolders to the classpath which exist on the filesystem.


(Derek.YC) #3

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’ ] }
}
}


(Mark Harkin) #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