Skip to content

Kover 0.9.7 incompatible with Kotlin 2.3.10 - "No matching variant" for kotlin-stdlib #798

@yonatankarp

Description

@yonatankarp

Description

When using Kover 0.9.7 with Kotlin 2.3.10, the build fails with a "No matching variant" error when resolving kotlin-stdlib for the koverExternalArtifacts configuration.

Environment

  • Kover version: 0.9.7
  • Kotlin version: 2.3.10
  • Gradle version: 9.3.1
  • Project type: Kotlin Multiplatform with JVM modules

Error Message

Could not resolve all files for configuration ':koverExternalArtifacts'.
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib:2.3.10.
  Required by:
      root project 'ff4k' > project :ff4k-store-sql-common
   > No matching variant of org.jetbrains.kotlin:kotlin-stdlib:2.3.10 was found. 
     The consumer was configured to find attribute 'kotlinx.kover.variant.name' with value '', 
     attribute 'kotlinx.kover.variant.origin' with value 'TOTAL', 
     attribute 'org.gradle.usage' with value 'kover' but:
       - Variant 'jvmApiElements':
           - Incompatible because this component declares attribute 'org.gradle.usage' 
             with value 'java-api' and the consumer needed attribute 'org.gradle.usage' 
             with value 'kover'
       ...

The error occurs because Kover is looking for a variant with org.gradle.usage = 'kover', but kotlin-stdlib:2.3.10 does not expose any variants with this attribute.

Steps to Reproduce

  1. Create a Kotlin JVM module in a multi-module project
  2. Apply Kover 0.9.7 to the root project
  3. Use Kotlin 2.3.10
  4. Run ./gradlew koverXmlReport

Workaround

Excluding the affected module from Kover resolves the issue:

dependencies {
    subprojects
        .filter { it.name.startsWith("my-") }
        .filter { "my-problematic-module" !in it.name }  // Workaround
        .forEach { kover(it) }
}

Expected Behavior

Kover should be compatible with Kotlin 2.3.10 and properly resolve dependencies without requiring special variant attributes from kotlin-stdlib.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions