I'm having trouble upgrading to kotlin 1.9.0 due to kotlinx-serialization. When I change the plugin ...
r
I'm having trouble upgrading to kotlin 1.9.0 due to kotlinx-serialization. When I change the plugin version reference for kotlinx-serialization to 1.9.0 for some reason Gradle attempts to download plugin version 1.8.10 instead. This fails for some reason, but it looks like version 1.8.10 does exist 🤷‍♂️. We are using kotlinx-serialization 1.5.1 btw. My first thought was that there is some kind of cache issue, but I tried clearing everything. Besides, the previous version we used was version 1.8.21 which worked fine. We're using version catalog to define the plugin:
plugin("kotlin-serialization", "org.jetbrains.kotlin.plugin.serialization").version("1.9.0")
and alias to bring in the plugin:
alias(_libs_._plugins_._kotlin_._serialization_)
, if it's overridden with
.version("1.8.21")
the build succeeds, so I don't think it's related to how the plugin is loaded. This is the error output I get:
Copy code
Execution failed for task ':core:compileKotlin'.
Could not resolve all files for configuration ':core:kotlinCompilerPluginClasspathMain'.
   > Could not find org.jetbrains.kotlin:kotlin-serialization-compiler-plugin-embeddable:1.8.10.
     Searched in the following locations:
       - <https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-serialization-compiler-plugin-embeddable/1.8.10/kotlin-serialization-compiler-plugin-embeddable-1.8.10.pom>
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :core
Any ideas?
e
the plugin version should match the compiler version, not the library version
are you somehow using KGP 1.8.x still? (for example, is there part of your build that is using
kotlin-dsl
or
embedded-kotlin
to build a gradle plugin?)
r
Kotlin version is only specified in my settings.gradle.kts afaik
I am loading ``kotlin-dsl`` but without specifying a version
Oh i see, that seems to be the problem
So kotlin-dsl is supposed to be set through the gradle version, but there doesnt seem to be a gradle version that uses 1.9.0 yet. I was using gradle 8.1.1 which I now upgraded to 8.2. This changes the kotlin-dsl version to use kotlin 1.8.22 which still does not solve the original problem.
e
yes. if you are using
kotlin-dsl
you are locked to Gradle's embedded Kotlin version, and it still is 1.8
I would recommend using
embeddedKotlinVersion
in your build scripts instead of the version catalog, for compatibility with
kotlin-dsl
/
embedded-kotlin
. for example,
Copy code
plugins {
    `kotlin-dsl`
   kotlin("plugin.serialization") version embeddedKotlinVersion
}
r
I was just thinking about how to do that instead, thanks! 😂
2957 Views