Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To ensure that the jvm target compatibility for the 'compileJava' task (11) and the 'compileKotlin' task (1.8) are both set to the same Java version, you can add the following code to your build.gradle.kts file:

tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "11"
}

tasks.withType<JavaCompile> {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
}

This code sets the jvm target compatibility for the 'compileKotlin' task to 11, and sets the sourceCompatibility and targetCompatibility for the 'compileJava' task to JavaVersion.VERSION_11, ensuring that both tasks are using the same Java version.