Buildship does not use the sourceSets with fewest excludes


(Horcrux7) #1

Our sourceSets look like (simplified):

sourceSets {
    main {
        java {
            srcDir 'src'
        }
    }
    javascriptCompress {
       resources {
           srcDir 'src'
           include '**/viewer/**/*.js'
           include '**/viewer/*.js'
      }
    }
}

This results in a .classpath:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry including="**/viewer/**/*.js|**/viewer/*.js" kind="src" path="src"/>

We have try to as first and as last sourceSets follow

eclipseClasspath {
    java {
        srcDir 'src'
    }
}

But it does not change any. This means the order of declaration is not important. This sounds like a bug. What is the best solution for it?


(Horcrux7) #2

A workaround is:

eclipse.classpath.file.whenMerged { classpath ->
            classpath.entries { entry ->
                if ( entry.kind == 'src' ) {
                    entry.includes = []
                    entry.excludes = []
                }
            }
}

(Stefan Oehme) #3

That’s a bug in Gradle, would you mind opening an issue? Glad you found a workaround already!


(Horcrux7) #4

Bug report: https://bugs.eclipse.org/bugs/show_bug.cgi?id=512021


(Stefan Oehme) #5

Sorry for not being more specific. This is not an issue in Buildship, it’s a bug in Gradle itself. @donat can you migrate that issue please?


(Donát Csikós) #6

Done: https://github.com/gradle/gradle/issues/1381