Hi, isn't this the correct way to specify the jvmT...
# gradle
j
Hi, isn't this the correct way to specify the jvmTarget in build.gradle.kts?
Copy code
configure(listOfKotlinProjects) {
...
    tasks.withType<KotlinCompile>().configureEach {
        kotlinOptions {
            jvmTarget = JavaVersion.VERSION_11.toString()
        }
    }
...
}
I'm trying to use a library as a dependency but the consuming library claims Incompatible because this component declares a component compatible with Java 15 and the consumer needed a component compatible with Java 11.
Turns out it was another java library in the consuming library requiring a class compiled without
Copy code
sourceCompatibility = JavaVersion.VERSION_11.toString()
targetCompatibility = JavaVersion.VERSION_11.toString()
I had tried that before without success. Turned out it needed to be put inside JavaCompile task configuration like so:
Copy code
tasks.withType<JavaCompile>().configureEach {
    sourceCompatibility = JavaVersion.VERSION_11.toString()
    targetCompatibility = JavaVersion.VERSION_11.toString()
}
I don't really understand why, but at least, now it works. 👍