Closed cherni78 closed 1 month ago
Reproduced here. We've been hit very hard by this issue; when refreshing gradle in eclipse everything's broken.
BTW: it still happens with SNAPSHOT version of buildship:
Eclipse Buildship Buildship, Eclipse Plug-ins for Gradle 3.1.7.v20220902-0443-s org.eclipse.buildship
Eclipse Buildship Buildship, Eclipse Plug-ins for Gradle 3.1.7.v20220902-0443-s org.eclipse.buildship.oomph
and gradle 7.5.1.
I just confirmed that downgrading to gradle 7.4.2 fixes the issue and that 7.5 reproduces the issue also.
Still the same problem with the actual version 7.6.
still happens in eclipse 2022-12 with gradle 7.6...
Still happens with latest snapshot of buildship (3.1.7.v20221111-0445-s)
is there any workaround other than downgrading gradle?
Unfortunately, no! Respectively no one that I would know.
seems related to https://github.com/gradle/gradle/issues/21853
Yes, it is related! The workaround mentioned there works for me too.
eclipse.classpath {
file.whenMerged { classpath ->
classpath.entries.findAll { entry -> entry instanceof org.gradle.plugins.ide.eclipse.model.ProjectDependency && entry.entryAttributes.test }
.each { it.entryAttributes['test'] = 'false' }
}
}
This is happening to me to. Gradle 8.1, Eclipse JDTLS 1.23.
The workaround above works. Here it is in Kotlin.
import org.gradle.plugins.ide.eclipse.model.ProjectDependency
import org.gradle.plugins.ide.eclipse.model.Classpath
eclipse.classpath.file {
whenMerged(Action<Classpath> { ->
entries.filter { entry -> entry is ProjectDependency && entry.entryAttributes.containsKey("test") }
.forEach { (it as ProjectDependency).entryAttributes["test"] = "false" }
})
}
When generating the eclipse project files with the eclipse plugin, aka ./gradlew eclipse
the files get generated just fine. So afaict this is more of a buildship issue, even if it just uses gradle classes.
But for me, this is just the next link in a long chain of issues with the gradle <-> eclipse connection. I'm tired. If you let this issue lying around, it'll solve itself because no one is using eclipse or gradle anymore.
E.g.: you can only do this workaround if you do it after the java plugin gets applied, because existing configs get mercilessly overwritten (https://github.com/gradle/gradle/blob/master/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/EclipsePlugin.java#L240) and while not recommended, you can do apply plugin: 'eclipse'
, then do your config, and then apply the java plugin (maybe because you do blanket-configs for all modules).
Should be closed as fixed then?
Expected Behavior
Eclipse compiles if I use testImplementation testFixtures and implementation of the same project as it does with
Gradle 7.4.2
!Current Behavior
As soon as I need the above listed configurations, Eclipse doesn't compile successful.
Context
A minimal setup to reproduce is present here: https://github.com/BisonSchweizAG/gradleproblem/tree/main
Steps to Reproduce
Clone above project, import into Eclipse --> will not compile! Build on command line will work. Remove needed line
testImplementation testFixtures(project(':projectA'))
frombuild.gradle
--> Eclipse compiles, command line build won't!Your Environment