Skip to content
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

Java Versions plugin doesn't support KotlinCompile #2274

Open
mglazer opened this issue May 13, 2022 · 0 comments
Open

Java Versions plugin doesn't support KotlinCompile #2274

mglazer opened this issue May 13, 2022 · 0 comments

Comments

@mglazer
Copy link
Contributor

mglazer commented May 13, 2022

What happened?

I have a project which uses Kotlin. I wish to use modern JVMs and therefore employ the Java Versions plugin. However, the current implementation of the Java Versions plugin only supports:

  • Groovy
  • Scala
  • Java

This all makes sense since these are in the public Java API. However, right now I have to add additional configuration:

kotlin {
    jvmToolchain {
        languageVersion.set(JavaLanguageVersion.of("17"))
    }
}

Per the docs: https://kotlinlang.org/docs/gradle.html#setting-jdk-version-with-the-task-dsl

to make this work.

What did you want to happen?

I'd want the Java versions plugin to configure my Kotlin compiler. I did a bit of sleuthing, and it does seem like this is fairly non-trivial to do if you don't want to bring in the entire Kotlin dependency to get access to the UsesKotlinJavaToolchain spec:

https://github.com/JetBrains/kotlin/blob/cca2680c7f1c3e690a9f4a56f13449f20ebfaa6d/libraries/tools/kotlin-gradle-plugin-api/src/common/kotlin/org/jetbrains/kotlin/gradle/tasks/UsesKotlinJavaToolchain.kt

Otherwise I probably would have committed a fix, which would have involved taking what is probably an undesirable dependency on Kotlin in this plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant