Is there a problem using a dependency that uses Ko...
# getting-started
d
Is there a problem using a dependency that uses Kotlin 2.1.0 (in a separate gradle module), where the codebase (in the main gradle module) itself is on 2.0.21? I don't think that dep actually uses any 2.1.0 features apart from ksp that seems to be working anyways... my main problem is that I think that Micronaut doesn't support 2.1.0 yet, and my data layer needs a library that depends on 2.1.0...
Now that I look at my dependencies gradle task output, it seems like Kotlin 2.1.0 is being pulled in even in my Micronaut module, just the ksp module stayed back at 2.0.21-...
e
you can only have one Kotlin Gradle Plugin version per build (root project and subprojects), which also determines the version of the Kotlin compiler
d
Funny that I'm not getting any funny crashes because of the different ksp-kotlin versions...
e
the Kotlin compiler can understand how to compile your code with libraries that were built with older, same, or 1 version newer Kotlin compiler
d
How does that work with ksp? And the fact that my libs.versions.toml declares the older version 2.0.21 tells 2.1.0 to compile at that version? So ksp's older version could still work? I'm not sure I understand what you mean by 1 version newer...
e
Copy code
plugins {
    kotlin("jvm") version "2.0.21"
}

dependencies {
    implementation(kotlin("stdlib", "2.1.0")) // or some other dependency that transitively includes Kotlin 2.1.0 stdlib
Kotlin's compiler API is not stable, but KSP presents a stable interface, so
Copy code
plugins {
    id("com.google.devtools.ksp") version "2.1.0-1.0.29"
}

dependencies {
    ksp("some-processor-built-with-older-ksp")
is OK too, even though
Copy code
dependencies {
    kotlinCompilerPluginClasspath("some-plugin-built-with-older-kotlinc")
is not OK
whether a dependency uses KSP itself doesn't make a difference at all. whatever processors it uses were run at the time of its build, and don't carry over to your build
d
But in my case my main module needs 2.0.21 and ksp corresponding to it and my data module is using 2.1.0 (Komapper needs ksp 2.1.0-...) how should I declare this? Can I just make the whole project depend on 2.0.21 and rely that Komapper (or the recent Kotlin Inject Anvil) is doing it's job correctly with ksp? It seems like they DON'T pull in the 2.1.0-... ksp plugin...
It seems like the two examples you showed are either this or that... so I'm not sure they apply to this particular case where I need somehow to work with both...
Unless I could just use the new ksp in the data module and the old one in the main module somehow... and then let 2.1.0 lead the show in both?
Is there some place where all this is documented? I'd really like to understand all this better... thanks for taking the time to explain what you have explained so far 😉!
j
Upgrading Kopy from 2.0.21 to 2.1.0 required no changes. That can be the reason ksp is not having any issue for you.