Kotlin repo build fails with `> Task :libraries...
# compiler
m
Kotlin repo build fails with
> Task :libraries:tools:mutability-annotations-compat:compileJava FAILED
error: Source option 6 is no longer supported. Use 7 or later.
error: Target option 6 is no longer supported. Use 7 or later.
on most recent master branch (de22a467a12714505a6f66f0a01bd7d7fc0ca9e2). Is it a know problem or something on my side?
s
I'm not sure about this, maybe kotlin doesn't support jdk6 anymore, maybe you need jdk7 and later to compile it.
m
I have jdk 6,7,8 and 15. But it looks like it comes from the build script of the module, it has:
project.updateJvmTarget("1.6")
I changed that to 1.8 and so far the compilation proceeds (it has not finished yet).
Yup, it compiled with the mentioned change.
👍 1
u
Be sure to check out the slightly updated instruction here: https://github.com/JetBrains/kotlin#build-environment-requirements
m
@udalov Yes, I followed that, that's how I managed to build everything. Only the one mentioned line of config was the problem. Is the team sure it is correct?
u
^ @tapchicoma
t
@mcpiroman with what exactly config line do you have problem?
m
@tapchicoma libraries\tools\mutability-annotations-compat\build.gradle.kts I changed
project.updateJvmTarget("1.6")
to
project.updateJvmTarget("1.8")
for the build to pass.
t
you should not change this, but rather add
kotlin.build.isObsoleteJdkOverrideEnabled=true
to the
local.properties
file
m
Interesting, as explained in https://github.com/JetBrains/kotlin#build-environment-requirements I only need this if I do not have Java 1.6 and 1.7, which I do (configured by
JDK_16
 and 
JDK_17
). I want to be able to build the whole project. Btw. while te
assemble
task passes, when I run `compilerTest`I get an error about unsupported java version 52.0, sth. like that. So maybe I have not configured something correctly?
t
Does running
./gradlew javaToolchains
task list your JDK 1.6 and 1.7?
m
Yup
Copy code
+ Oracle JDK 1.7.0_80
     | Location:           C:\Program Files\Java\jdk1.7.0_80
     | Language Version:   7
     | Vendor:             Oracle
     | Is JDK:             true
     | Detected by:        Windows Registry

 + Sun Microsystems Inc. JDK 1.6.0_45
     | Location:           C:\Program Files\Java\jdk1.6.0_45
     | Language Version:   6
     | Vendor:             Sun Microsystems Inc.
     | Is JDK:             true
     | Detected by:        Windows Registry
t
with which JDK version are you running Gradle daemon?
m
With openjdk 15.1. But now when I ran
compilerTest
the mentioned error does not occur. Instead there expected failing tests regarding my changes in the compiler. (FYI I have rebased the repo last week.) So it may be that the issue is gone, or that gradle just reordered some tasks or something and I will hit the same thing later, I can't say until I fix the tests.
👍 1
t
Commit, you've mentioned in initial message, should actually fix the issue of running Gradle daemon on >JDK 1.8. JDK 15 does not support anymore target
6
m
Oh, so what JDK should I run the gradle with? Or does it mean that I can use 15 since that commit?
t
you could use any JDK to run Gradle since that commit
before java-only modules use Gradle JDK version instead of project default JDK 1.8
m
Ok, thanks. I will post here if it happens that the corrected kotlin project does not want to build anyway.
👍 1
I've run the previous in terminal. But now that I execute
compilerTest
from Intellij, I get:
Copy code
> Task :kotlin-scripting-jvm:test
FATAL ERROR in native method: processing of -javaagent failed
java.lang.UnsupportedClassVersionError: kotlinx/coroutines/debug/AgentPremain : Unsupported major.minor version 52.0
The gradle uses jdk 15.1 as well. Project SDK is also set to 15.1.
I mean 15.0.1
t
I will check this 🤔 Though according to
java.lang.UnsupportedClassVersionError: kotlinx/coroutines/debug/AgentPremain : Unsupported major.minor version 52.0
message - error in
kotlinx.coroutines
artifact that located in the separate repository that was not yet migrated to the Gradle toolchain feature. Better to use JDK 11 to compile it.