Can't add Kotlin JVM library as dependency to another Kotlin JVM library due to target JDK version

Hi all,

I maintain two open source, Kotlin/JVM libraries, and one of them requires the other. Both libraries must support JDK 8 and 11, and they must also work on Android.

The Gradle build file for each library is configured to target Java 1.8:

But if I try to add tech.relaycorp:relaynet as a dependency to tech.relaycorp:cogrpc, gradle build fails with a long list of errors, the first of which reads Required org.gradle.jvm.version '8' and found incompatible value '11'. See:

What am I doing wrong?


I’ve just fixed this issue by making sure the process doing the release used Java 8 instead of Java 11. However, what’s the point of specifying the target JDK version in build.gradle.kts if I still have to do that?