This message was deleted.
# community-support
s
This message was deleted.
v
Unknown Kotlin JVM target
so this is most likely not a Gradle question, but a question for the Kotlin Gradle plugin.
Besides that, I guess it means that the Kotlin version you use is not compatible to Java 20
m
Well, it should be, given that I just merged the develop branch to my feature branch, which indicates that it works for everybody else. But thanks for redirecting me to the Kotlin Gradle plugin, that’s hopefully one step closer to understanding what exactly the issue is here 🤔
I suspect it’s something wrong with my local setup, but I can’t figure out where to start.
m
Gradle itself cannot yet run with Java 20. Do you use Kotlin for build scripts in your project?
m
Yes.
Here’s more detail:
Copy code
Running Spotless on the entire project.
Type-safe project accessors is an incubating feature.
> Task :buildSrc:compileKotlin FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':buildSrc:compileKotlin'.
> Error while evaluating property 'compilerOptions.jvmTarget' of task ':buildSrc:compileKotlin'.
   > Failed to calculate the value of property 'jvmTarget'.
      > Unknown Kotlin JVM target: 20
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at <https://help.gradle.org>
BUILD FAILED in 506ms
1 actionable task: 1 executed
Spotless Gradle task exit code: 1.
Completed Spotless hook.
m
Kotlin version bundled with Gradle has some known incompatibilites, AFAIK. I guess you're hitting one of them
v
Ah, right, thanks Mikhail
m
You can find further compatibility information at https://docs.gradle.org/current/userguide/compatibility.html
m
Hm, I’m not sure I see the issue then.
./gradlew -version
outputs this:
Copy code
------------------------------------------------------------
Gradle 8.1.1
------------------------------------------------------------

Build time:   2023-04-21 12:31:26 UTC
Revision:     1cf537a851c635c364a4214885f8b9798051175b

Kotlin:       1.8.10
Groovy:       3.0.15
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          20.0.1 (Homebrew 20.0.1)
OS:           Mac OS X 13.4.1 aarch64
So it looks like this should fit together?
m
Well, it shows you're running Gradle 8.1.1 on Java 20. This combination is not supported (yet). For better or worse, Gradle has no strict check "hey, it's Java 20, I quit immediately" like it has for Java 6 and 7, so some parts still work, but not everything. Kotlin scripting is one of the things that don't work.
💡 1
m
@Mikhail Lopatkin Thank you, this helped me solve the problem, even though I’m not entirely clear on how these things fit together. It seems that we don’t have 20 specified anywhere, so I completely uninstalled openjdk@20 and now it works, because it now uses 17.
v
The Gradle start script uses the value of
JAVA_HOME
that you said you have set to 20, or if it is not set the
java
that is in the
PATH
646 Views