Eclipse classpath ordering - project dependency always at the bottom of dependencies

Perhaps you could approach this another way and instead tweak the jar to remove the offending class file. Then you wouldn’t need to rely on classpath ordering.

configurations {
   commonsConfig { transitive = false }
}
dependencies {
    commonsConfig "commons-config:commons-config:1.10"
    compile files("$buildDir/tweaked-commons-config.jar")
}
task tweakCommonsConfig(type:Jar) {
   from zipTree(configurations.commonsConfig.singleFile).matching {
      exclude 'path/to/some.class'
   }
   destinationDir buildDir
   archiveName 'tweaked-commons-config.jar'
}
compileJava.dependsOn tweakCommonsConfig
1 Like