DoHyung Kim
06/11/2024, 8:57 AMbuildSrc directory. The plugin applies kotlin("jvm") plugin inside. It doesn't specify the Kotlin plugin version there, and the implementation dependency of the buildSrc is set to the right Kotlin version, where, in my case, 2.0.0. But when I apply the script plugin to my subprojects in the same root project. It seems that the version of Kotlin plugin applied to them is not the intended 2.0.0 but that of the Kotlin plugin bundled with Gradle, I guess. My guess is both the Kotlin plugin Gradle uses and another specified as a dependency to the buildSrc are in the build classpath, and the Gradle one seems picked up when the script plugin applied.
Is there a problem I outlined above in the current version of Gradle? I tested with 8.8.
And if so, is there any way to get the right version (2.0.0) of the Kotlin plugin applied as I intend?DoHyung Kim
06/11/2024, 8:59 AMbuild.gradle.kts , it works ok.Adam
06/11/2024, 9:47 AMDoHyung Kim
06/12/2024, 4:14 AMplugins {
`kotlin-dsl`
}
repositories {
mavenCentral()
}
dependencies {
implementation(libs.plugin.kotlin.jvm)
implementation(libs.plugin.ksp)
implementation(libs.auto.service.ksp)
implementation(libs.auto.service.annotations)
}
kotlin {
jvmToolchain(21)
}DoHyung Kim
06/12/2024, 4:15 AMplugin-kotlin-jvm = { module = "org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin", version.ref = "kotlin" }
plugin-ksp = { module = "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" }DoHyung Kim
06/12/2024, 4:16 AMplugins {
kotlin("jvm")
`maven-publish`
}
repositories {
mavenCentral()
maven {
url = uri("<https://jitpack.io>")
}
}
kotlin {
jvmToolchain(21)
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}Adam
06/12/2024, 6:40 AMAdam
06/12/2024, 6:41 AMDoHyung Kim
06/12/2024, 7:40 AMInconsistent JVM-target compatibility detected for tasks ‘compileJava’ (22) and ‘compileKotlin’ (21).Consider using JVM Toolchain: https://kotl.in/gradle/jvm/toolchain Learn more about JVM-target validation: https://kotl.in/gradle/jvm/target-validation * Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.BUILD FAILED in 480ms
DoHyung Kim
06/12/2024, 7:40 AMDoHyung Kim
06/12/2024, 7:40 AMDoHyung Kim
06/12/2024, 7:41 AMDoHyung Kim
06/12/2024, 7:41 AMVampire
06/12/2024, 7:45 AM--scan URL? That should make it very obvious which versions of what are used where.Adam
06/12/2024, 7:46 AMprintln("KotlinVersion.CURRENT: ${KotlinVersion.CURRENT}")
println("kotlinToolingVersion: $kotlinToolingVersion")DoHyung Kim
06/12/2024, 8:00 AMDoHyung Kim
06/12/2024, 8:01 AMAdam
06/12/2024, 8:04 AMbuildSrc project will use the Kotlin version embedded into Gradle, which isn't 2.0 yet https://docs.gradle.org/8.8/userguide/compatibility.html#kotlinAdam
06/12/2024, 8:07 AMprintln("embeddedKotlinVersion: $embeddedKotlinVersion") // Gradle builds/runs build scripts with this Kotlin
println("kotlinToolingVersion: $kotlinToolingVersion") // Kotlin version used to build/run project sources