google / ksp

Kotlin Symbol Processing API
https://github.com/google/ksp
Apache License 2.0
2.72k stars 254 forks source link

kspKotlin -api-version (2.0) cannot be greater than -language-version (1.9) #1942

Open hantsy opened 4 weeks ago

hantsy commented 4 weeks ago

After upgraded to Kotlin 2.0, and setup the apiVersion and languageVersion to KOTLIN_2.


kotlin {
    compilerOptions {
        freeCompilerArgs.addAll(
            "-Xjsr305=strict",
            "-opt-in=kotlin.RequiresOptIn",
            "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
        )
        apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
        languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
        jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21)
    }
}

And then I got the error like this:

kspKotlin -api-version (2.0) cannot be greater than -language-version (1.9)
dogeweb commented 3 weeks ago

Hi, adding ksp.useKSP2=true in gradle.properties should solve the issue