Hello! I have found next in the docs: “When there ...
# gradle
d
Hello! I have found next in the docs: “When there is no explicit information about the jvmTarget value in the build script, its default value is null, and the compiler translates it to the default value 1.8. The targetCompatibility equals a current Gradle’s JDK version, which is equal to your JDK version (unless you use a Java toolchain approach). Assume that this version is 11. Your published library artifact will declare the compatibility with JDK 11+: org.gradle.jvm.version=11, which is wrong. You will have to use Java 11 in your main project to add this library, although the bytecode’s version is 1.8. Configure a toolchain to solve this issue.” I couldn’t understand why bytecode is 1.8 if compileJava task has java version 11? Also would it be a behaviour issue if the version for kotlin task and java task is different? Thanks
v
I couldn’t understand why bytecode is 1.8 if compileJava task has java version 11?
Don't confuse bytecode created by
compileJava
with bytecode created by
compileKotlin
. Former will be 11, latter 8. But the module metadata will know you need at least Java 11 to consume the lib, even if no Java sources were processed. One of the reasons why it is better to set it consistently
d
ah, got you. Thank you for your reply
👌 1