New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate entry in generated .classpath file in Gradle >= 5.6 #10393
Comments
Thanks for investigating this! I'm looking forward to the JUnit 5 projects working in Eclipse again (without having to manually delete those duplicate classpath entries). 😉 |
Possibly related to #9405. |
Workaround: import org.gradle.plugins.ide.eclipse.model.Classpath
eclipse.classpath.file {
whenMerged(Action<Classpath> {
entries = entries.distinctBy {
if (it is org.gradle.plugins.ide.eclipse.model.ProjectDependency)
it.path
else
it
}
})
} |
We are seeing duplicate project dependencies ending up in the generated .classpath files with 5.6 and 5.6.1 in Ghidra as well. |
FYI: to get the above Kotlin-based workaround to work, you'll need the following. import org.gradle.plugins.ide.eclipse.model.Classpath |
The workaround used in this commit was authored by @marcphilipp for gradle/gradle#10393.
I can confirm that the provided workaround solves the issue for the time being. See junit-team/junit5@3e9565a. Thanks, @marcphilipp! |
Would you mind posting an equivalent groovy workaround? |
I don't have one handy, but the following documentation should be helpful. https://docs.gradle.org/current/userguide/eclipse_plugin.html#sec:eclipse_modify_domain_objects |
And the customization I wrote here might prove useful as well for the Groovy syntax: https://github.com/spring-projects/spring-framework/blob/8d86a861a1eff13dd1abe14829e4213200509300/gradle/ide.gradle#L50-L57 |
@ryanmkurtz Here's a Groovy version: eclipse.classpath.file {
whenMerged {
entries.unique(true) {
(it instanceof org.gradle.plugins.ide.eclipse.model.ProjectDependency) ? it.path : it
}
}
} |
Expected Behavior
Given a
consumer
project with the following dependencies, theconsumer/.classpath
file generated by calling./gradlew eclipse
should only contain a single<classpathentry kind="src" path="/producer"/>
entry.Current Behavior
With Gradle 5.6 it contains two such entries and causes Eclipse to show a "duplicate classpath entry" error.
In Gradle 5.5 and below only a single entry is generated.
Context
The project is unusable in Eclipse until the duplicate entry is deleted manually.
Steps to Reproduce
eclipse-multiple-project-dependencies
, run./gradlew eclipse
consumer/.classpath
file or open the project in EclipseThe text was updated successfully, but these errors were encountered: