Good morning! I wanted to try out K2, but I cannot...
# k2-adopters
m
Good morning! I wanted to try out K2, but I cannot activate it in my project. When I add the code snippet from the instructions to the build.gradle.kts, I get
Incorrect language version. Expected one of: '1.0', '1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '1.8', '1.9'
(with plugin 1.8.20). Any ideas?
Copy code
kotlin {
    sourceSets.all {
        languageSettings {
            languageVersion = "2.0"
        }
    }
}
s
Please make sure you're using Kotlin 1.8.20 Gradle plugin
m
image.png
Ah, hold on …
Now it works! Turns out that unless I specifically say
Copy code
plugins {
  id("org.jetbrains.kotlin.jvm") version "1.8.20"
}
It doesn’t work. Which opens the question: When I just say
Copy code
plugins {
  id("org.jetbrains.kotlin.jvm")
}
Which version does it use?
s
Highly likely you have some other kotlin plugin block somewhere in your gradle configuration Search for "org.jetbrains.kotlin.jvm" across the sources of your gradle files
m
You are correct. I started this project through an nx template, and it had a variable
kotlinJvmVersion
defined as
1.8.0
. That tricked me into thinking it was a JVM language version, which of course would also not be exactly right. Maybe it’s because I have to work with Java 1.8 in client projects a lot …
s
Ah! It happens sometimes, especially when working with templates Great to know that you found it 🙂