Hello I have this test which runs fine from termin...
# gradle
n
Hello I have this test which runs fine from terminal but fails when started from Intellij Execution failed for task ':compileKotlin'.
Inconsistent JVM-target compatibility detected for tasks 'compileJava' (17) and 'compileKotlin' (21).
I've checked the settings and the sdk is set to openjdk21 I repeat: if I run gradlew clean test from terminal everything runs ok. It is a problem with some intellij project settings I think ... but which one? Thanks a lot
m
Probably your JAVA_HOME is different in your CLI vs IntelliJ
You can check it in the settings (Build Tools -> Gradle) but in all cases, you probably want to be explicit about the targetted JVM bytecode so that it does not depend on your current Java version
n
I have not setted JAVA_HOME at all, it seems , I use jenv to set local/global in the terminal
thanks a lot I will check into this
yes it was it, in build tools->gradle there was jdk 17 I've forgot that one Thanks again 👍
strange thing is that IntelliJ says that java 21 needs gradle 8.5, but I have 8.4 in the terminal and runs fine.. I will upgrade anyway
v
It is not officially supported and so some things might not work. But you could also be lucky and it works. But yeah, better is a compatible Java version to run Gradle: https://docs.gradle.org/current/userguide/compatibility.html And consider decoupling the Java version used to run Gradle from the Java version used to build and run your code using the toolchains feature.
n
"toolchains feature" ? Ok I will look about it, thanks a lot
n
thanks!!
👌 1
444 Views