kotlin-eclipse-2022
kotlin-eclipse-2022 copied to clipboard
Add Kotlin container to Eclipse classpath containers
The org.jetbrains.kotlin.core.KOTLIN_CONTAINER
is not be added to the Eclipse project .classpath files.
We have multi-module Gradle projects with mixed languages. The Java and Groovy source sets cannot "find" the Kotlin classes without adding the KOTLIN_CONTAINER to the .classpath files.
Eclipse 2022_09 (v4.25) Plugin from https://s3.eu-central-1.amazonaws.com/github.bvfalcon/kotlin-eclipse/eclipse-releases/2022-09/
I'm currently using this workaround in my ~\.gradle\init.gradle
file to fixup the .classpath files:
allprojects {
if (project.plugins.hasPlugin(EclipsePlugin)) {
eclipse.synchronizationTasks {
def fixKotlinContainer = (project.tasks.find({ it.name.matches("^compile.*Kotlin\$")}) != null) // find first kotlin compile task; null if none.
if (fixKotlinContainer) {
println "Adding KOTLIN_CONTAINER for ${eclipse.project.name}"
eclipse.classpath.containers 'org.jetbrains.kotlin.core.KOTLIN_CONTAINER'
}
}
}
}
which gets me the KOTLIN_CONTAINER in my classpath files:
...
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
<classpathentry kind="con" path="org.jetbrains.kotlin.core.KOTLIN_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
...
Yes this is because the upstream has removed gradle support if I remember correctly. But if we can fix the issues by enabling the gradle support it should work. Could you look into and provide a PR ? The required code should be inside the gradle sub module