Gradle eclipseClassPath incorrectly excludes java sources for resource exclude

Given a project with the usual Eclipse project layout:

sourceSets {
  main {
    java {
      srcDirs = ['src']
    }
    resources {
      srcDirs = ['src']
      exclude '**/*.java'
    }
  }
}

The generated classpath contains a source entry with an exclude for all Java files. This means that Java files won’t even be shown in the Package Explorer and also won’t be compiled. Gradle should not add source entry filters.

If you want to add resource copy filters, the correct place to do that is Settings -> JavaCompiler - >Building > Exclude. Also, only the excludes from the “resources” SourceDirectorySet should be considered.

Hey Stefan,
thanks for the report. I’ve raised GRADLE-3335 for this.

cheers,
René

Hey Stefan,
I just pushed a fix for this. This will be in 2.7 and available already in the upcoming nightlies if you wanna test it out upfront.

cheers,
René

Hey René,

I can verify this works with the latest nightly.

Cheers,
Stefan

Hey Stefan,

yes the latest nightly should include the fix.

cheers,
René

My reply was not a question, but a statement: It works for me =)

ups. thanks for verifying anyway :slight_smile: