Open philwebb opened 1 year ago
The org.jetbrains.kotlin.jvm
plugin contributes the build directories to the testCompileClasspath
. Buildship puts both the production and the test dependencies to the same classpath, that's why you see it. There are a couple of workarounds you can do:
eclipse.classpath.file.whenMerged {}
callback.Thanks @donat! This commit did the trick for us https://github.com/spring-projects/spring-boot/commit/13d00d85e0f1af49356ea19fe7ec09cce74975a3
@donat I think we have a similar problem with Spring Boot's Gradle Plugin for ahead-of-time processing. Is this something that you can fix in Buildship? My expectation was that it would "deduplicate" build/classes/java
and bin/main
, only keeping the latter as it's the Eclipse-specific equivalent of the former.
See also #1236 (probably would be fixed the same way - de-deuplication of classpath entries).
Kotlin 1.9.0 will restore the behaviour in 1.8.10
Unfortunately, we detected that reverting the behaviour back to 1.8.10 clashes with a workaround applied for: https://youtrack.jetbrains.com/issue/KT-58280/org.jetbrains.kotlin.jvm-Gradle-plugin-contributes-build-directories-to-the-test-compile-classpath
Which relates to https://github.com/gradle/gradle/issues/23932
I therefore need to revoke the previous message. We are aiming to restore behaviour in 1.9, but the first attempt failed and the initial beta is right around the corner already.
cc @Tapchicoma
AIUI, the NBT Gradle Plugin also configures things in such a way that build/main
entries end up on the classpath when using Buildship. IMO, it would be better to fix this at source in Buildship rather than multiple plugins all working around the problem.
For now, the change in KGP was reverted and will likely be shipped in 1.9.0-Beta
Expected Behavior
When importing a project that has the Kotlin Gradle plugin the eclipse classpath should not include entries for the
build/classes/java
andbuild/classes/kotlin
. Having these additional entries makes Eclipse hard to use. For example, searching for a type will find both the source code and the previously built.class
file.Current Behavior
When using Kotlin 1.8.20 additional classpath entries are added. Downgrading to Kotlin 1.8.10 fixes the issue.
Context
Originally discovered in https://github.com/spring-projects/spring-boot/issues/35101
Steps to Reproduce
https://github.com/philwebb/kotlin-buildship-classpath-bug
Your Environment
Details are in the reproducer project readme