Jonathan Olsson
05/08/2021, 8:21 PMconfigure(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.Jonathan Olsson
05/08/2021, 8:57 PMsourceCompatibility = 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:
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. 👍