in gradle 7 with KGP 1.8.22, has anyone gotten ```...
# gradle
w
in gradle 7 with KGP 1.8.22, has anyone gotten
Copy code
'compileTestJava' task (current target is 11) and 'compileTestKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.
By default will become an error since Gradle 8.0+! Read more: <https://kotl.in/gradle/jvm/target-validation>
Consider using JVM toolchain: <https://kotl.in/gradle/jvm/toolchain>
but they have
Copy code
java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(11))
    }
}
c
what isn’t set is the Kotlin java version to use, they must match.
w
yeah... I just read in the docs that setting that is optional and that if you set the java toolchain, kotlin will use that
but maybe that is not the case?
c
That’s the case for newer Gradle versions, not older ones.
hence the warning.
w
ahh
v
Nah, that has nothing to do with the Gradle version, but with the KGP version.
The warning says that such inconsistent configuration will be an error then, doesn't it?
I would suspect that even though the toolchain is used, the JVM target additionally is overwritten to 8
Or the KGP version is that old that it does but consider the toolchain
w
yeah, but I am not doing that in my script, so it should be set automatically to match the toolchain
KGP is 1.8.22 so not super old
but maybe old enough
v
No
Should work with that
Maybe your have some plugin that sets it or similar
1
w
im pretty sure not, but i can dig into that
t
Do you explicitly specify somewhere
jvmTarget
? It will override the value from toolchain.
w
i used to have
Copy code
subprojects {
    plugins.withId("org.jetbrains.kotlin.jvm"){
        tasks.withType<KotlinCompile> {
            kotlinOptions {
                languageVersion = "1.6"
                apiVersion = "1.6"
                jvmTarget = "11"
            }
        }
    }
}
on my root build, but i changed that to
Copy code
subprojects {
    plugins.withId("org.jetbrains.kotlin.jvm"){
        tasks.withType<KotlinCompile> {
            kotlinOptions {
                languageVersion = "1.6"
                apiVersion = "1.6"
            }
        }
    }
}
now and that is when the warning showed up
t
then it is strange, please try to update Kotlin version in the repo