Piotr Krzemiński
02/20/2025, 3:06 PM.github/workflows/end-to-end-tests.main.kts
here: https://github.com/typesafegithub/github-workflows-kt/actions/runs/13436465865/job/37545104505?pr=1830 causes:
java.lang.NoClassDefFoundError: kotlinx/io/unsafe/UnsafeBufferOperations
.
So far I checked that:
• @file:DependsOn("io.github.typesafegithub:action-updates-checker:3.2.1-SNAPSHOT")
and any pieces that depend on functions from it, it works - so this package is to blame
• UnsafeBufferOperations
was introduced in kotlinx-io 0.5.0
• ktor started using kotlinx-io starting 3.1.0 in this commit
Something must still depend on kotlinx-io older than 0.5.0, but I cannot pin it down...Piotr Krzemiński
02/20/2025, 3:08 PMPiotr Krzemiński
02/20/2025, 3:12 PMVampire
02/20/2025, 5:40 PMhow do I check how Scripting resolves the versions of transitive dependencies?You don't really want to know. 😄
Vampire
02/20/2025, 5:43 PMPiotr Krzemiński
02/20/2025, 5:47 PMPiotr Krzemiński
02/20/2025, 5:47 PMVampire
02/20/2025, 5:55 PMPiotr Krzemiński
02/20/2025, 7:47 PM@file:Repository("<https://repo.maven.apache.org/maven2/>")
@file:DependsOn("org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.6.0")
above
@file:DependsOn("io.github.typesafegithub:action-updates-checker:3.2.1-SNAPSHOT")
just changed the error message to
java.lang.NoSuchMethodError: 'kotlinx.io.Segment kotlinx.io.Buffer.writableSegment(int)'
looking at ./gradlew action-update-checker:dependencies
, looks like kotlinx.serialization is to blame - it still depends on kotlinx-io 0.4.0, and apparently the changes between the versions are breaking enough to make the explicit override not workPiotr Krzemiński
02/20/2025, 7:50 PM+--- io.ktor:ktor-io:3.1.0
| \--- io.ktor:ktor-io-jvm:3.1.0
| +--- org.slf4j:slf4j-api:2.0.16
| +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1 (*)
| +--- org.jetbrains.kotlinx:kotlinx-io-core:0.6.0
but on the other, on 0.4.0:
io.ktor:ktor-serialization-kotlinx-json:3.1.0
\--- io.ktor:ktor-serialization-kotlinx-json-jvm:3.1.0
+--- org.slf4j:slf4j-api:2.0.16
+--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1 (*)
+--- io.ktor:ktor-http:3.1.0 (*)
+--- io.ktor:ktor-serialization-kotlinx:3.1.0
| \--- io.ktor:ktor-serialization-kotlinx-jvm:3.1.0
| +--- org.slf4j:slf4j-api:2.0.16
| +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1 (*)
| +--- io.ktor:ktor-http:3.1.0 (*)
| +--- io.ktor:ktor-serialization:3.1.0 (*)
| +--- org.jetbrains.kotlinx:kotlinx-serialization-core:1.8.0 (*)
| \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.10 (*)
+--- org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0 (*)
+--- org.jetbrains.kotlinx:kotlinx-serialization-json-io:1.8.0
| \--- org.jetbrains.kotlinx:kotlinx-serialization-json-io-jvm:1.8.0
| +--- org.jetbrains.kotlinx:kotlinx-serialization-bom:1.8.0 (*)
| +--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0 -> 2.1.10 (*)
| +--- org.jetbrains.kotlinx:kotlinx-serialization-core:1.8.0 (*)
| +--- org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0 (*)
| \--- org.jetbrains.kotlinx:kotlinx-io-core:0.4.0 -> 0.6.0 (*)
Piotr Krzemiński
02/20/2025, 7:50 PM-> 0.6.0 (*)
means that Gradle somehow deals with it, although I don't know how, and Scripting doesn'tPiotr Krzemiński
02/20/2025, 8:02 PMVampire
02/20/2025, 8:15 PMVampire
02/20/2025, 8:16 PMVampire
02/20/2025, 8:17 PMVampire
02/20/2025, 8:18 PMPiotr Krzemiński
02/20/2025, 8:24 PMYou probably have to exclude the dependency additionally from that dependency.I tried
implementation(projects.sharedInternal) {
exclude("org.jetbrains.kotlinx", "kotlinx-io-core")
}
but it doesn't work, I'm lost... I've never fought that hard with dependencies. Could you hint me more on how to sort it out?Piotr Krzemiński
02/20/2025, 8:24 PMPiotr Krzemiński
02/20/2025, 8:26 PMVampire
02/20/2025, 10:39 PMI tried ... but it doesn't workI meant in the script. If you want to fix it in that build, I think you should there add an explicit dependency on
kotlinx-io-core
.
Because currently you have for the 0.6.0
action-updates-checker
-> github-workflows-kt
-> shared-internal
-> io.ktor:ktor-client-core
-> io.ktor:ktor-client-core-jvm
-> io.ktor:ktor-http
-> io.ktor:ktor-http-jvm
-> io.ktor:ktor-utils
-> io.ktor:ktor-utils-jvm
-> io.ktor:ktor-io
-> io.ktor:ktor-io-jvm
-> org.jetbrains.kotlinx:kotlinx-io-core:0.6.0
-> org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.6.0
and for the 0.4.0
action-updates-checker
-> github-workflows-kt
-> shared-internal
-> io.ktor:ktor-serialization-kotlinx-json
-> io.ktor:ktor-serialization-kotlinx-json-jvm
-> org.jetbrains.kotlinx:kotlinx-serialization-json-io
-> org.jetbrains.kotlinx:kotlinx-serialization-json-io-jvm
-> org.jetbrains.kotlinx:kotlinx-io-core:0.4.0
-> org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.4.0
so the path to the 0.4.0 is shorter and thus wins following the non-sense Maven logic while Gradle does proper conflict resolution and uses the newer.
So to tame the aether resolver, you have to provide a shorter path for 0.6.0.
As the common hook-point is shared-internal
, I'd say you should there add a runtimeOnly
dependency on 0.6.0, then the path to it is shorter than to the 0.4.0 and Aether should use that.Piotr Krzemiński
02/21/2025, 6:39 AM