heya, we are trying to upgrade to kotlin 2.0.0 and...
# community-support
i
heya, we are trying to upgrade to kotlin 2.0.0 and we use dependency locking (for change detection mostly) and with new kotlin version we get this error when running `resolveAndLockAll --write-locks --no-configuration-cache`:
Copy code
Execution failed for task ':resolveAndLockAll'.
> Could not resolve all files for configuration ':dependencySources'.
   > Could not resolve com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1.
     Required by:
         project :
      > No matching variant of com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1 was found. The consumer was configured to find sources for use during runtime, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
          - Variant 'apiElements' declares a component, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a library for use during compile-time and the consumer needed documentation for use during runtime
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
                  - Doesn't say anything about the documentation type (required sources)
          - Variant 'runtimeElements' declares a component for use during runtime, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a library and the consumer needed documentation
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
                  - Doesn't say anything about the documentation type (required sources)
It is reproducible in empty project:
Copy code
plugins {
    kotlin("jvm") version "2.0.0"
}

repositories {
    mavenCentral()
}

kotlin {
    jvmToolchain {
        languageVersion = JavaLanguageVersion.of(21)
        vendor = JvmVendorSpec.AMAZON
    }
}

dependencies {
    implementation("dev.forkhandles:result4k:2.18.0.0")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1")
    implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.1")
}

// <https://docs.gradle.org/current/userguide/dependency_locking.html>
// lock versions to make the detection of dependency changes trigger only related builds
dependencyLocking {
    lockAllConfigurations()
    lockMode = LockMode.LENIENT
}

tasks.register("resolveAndLockAll") {
    notCompatibleWithConfigurationCache("Filters configurations at execution time")
    doFirst {
        require(gradle.startParameter.isWriteDependencyLocks) { "$path must be run from the command line with the `--write-locks` flag" }
    }
    doLast {
        configurations.filter {
            it.isCanBeResolved
        }.forEach { it.resolve() }
    }
}
Note: compilation or test tasks work alright, but the locking fails. Interestingly is that its just jackson dependency complaining, if i remove it and use smth else (like result4k), then it passes. Gradle version: 8.7 Any idea what could be the solution?
v
So upvote and watch that issue, and either wait for 2.0.20, or exclude those sources configurations from your "resolve all resolvable" logic.
i
thanks! 🍺
👌 1