Browse Source

Remove classpath entries for non-existent libraries added by mrjar plugin

The me.champeau.mrjar Gradle plugin causes non-existent libraries to be
added to the Eclipse classpath, such as:

<classpathentry kind="lib" path="/workspaces/spring-framework/spring-core/build/classes/kotlin/java21">
  <attributes>
    <attribute name="gradle_used_by_scope" value="java21"/>
    <attribute name="test" value="true"/>
  </attributes>
</classpathentry>

This results in build errors in Eclipse IDE like the following.

Project 'spring-core' is missing required library:
  '/workspaces/spring-framework/spring-core/build/classes/kotlin/java21'

This commit filters those and removes them.
pull/31519/head
Sam Brannen 2 years ago
parent
commit
8770544769
  1. 9
      gradle/ide.gradle

9
gradle/ide.gradle

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
import org.gradle.plugins.ide.eclipse.model.Library
import org.gradle.plugins.ide.eclipse.model.ProjectDependency
import org.gradle.plugins.ide.eclipse.model.SourceFolder
@ -67,6 +68,14 @@ eclipse.classpath.file.whenMerged { @@ -67,6 +68,14 @@ eclipse.classpath.file.whenMerged {
}
}
// Remove classpath entries for non-existent libraries added by the me.champeau.mrjar
// plugin, such as "spring-core/build/classes/kotlin/java21".
eclipse.classpath.file.whenMerged {
entries.findAll { it instanceof Library && !file(it.path).exists() }.each {
entries.remove(it)
}
}
// Include project specific settings
task eclipseSettings(type: Copy) {
from rootProject.files(

Loading…
Cancel
Save