Buildship does not use the sourceSets with fewest excludes

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?

A workaround is:

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

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

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

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?

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