https://kotlinlang.org logo
#detekt
Title
# detekt
b

BorzdeG

10/06/2020, 5:56 PM
Copy code
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':myproject:detekt'.
> Could not resolve all files for configuration ':myproject:detekt'.
   > Could not resolve org.jetbrains.kotlinx:kotlinx-html-jvm.
     Required by:
         project :myproject > io.gitlab.arturbosch.detekt:detekt-cli:1.14.1 > io.gitlab.arturbosch.detekt:detekt-bom:1.14.1
      > Cannot choose between the following variants of org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2:
          - jvm-api
          - jvm-runtime
          - metadata-api
        All of them match the consumer attributes:
          - Variant 'jvm-api' capability org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2:
              - Unmatched attributes:
                  - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-api' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'jvm' but the consumer didn't ask for it
          - Variant 'jvm-runtime' capability org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2:
              - Unmatched attributes:
                  - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'jvm' but the consumer didn't ask for it
          - Variant 'metadata-api' capability org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2:
              - Unmatched attributes:
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'kotlin-api' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'common' but the consumer didn't ask for it
   > Could not resolve org.jetbrains.kotlinx:kotlinx-html-jvm.
     Required by:
         project :myproject > io.gitlab.arturbosch.detekt:detekt-cli:1.14.1 > io.gitlab.arturbosch.detekt:detekt-core:1.14.1 > io.gitlab.arturbosch.detekt:detekt-report-html:1.14.1
      > Cannot choose between the following variants of org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2:
          - jvm-api
          - jvm-runtime
          - metadata-api
        All of them match the consumer attributes:
          - Variant 'jvm-api' capability org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2:
              - Unmatched attributes:
                  - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-api' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'jvm' but the consumer didn't ask for it
          - Variant 'jvm-runtime' capability org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2:
              - Unmatched attributes:
                  - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'jvm' but the consumer didn't ask for it
          - Variant 'metadata-api' capability org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2:
              - Unmatched attributes:
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'kotlin-api' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'common' but the consumer didn't ask for it
Upgrading Gradle from 6.6.1 to 6.8 and JDK from 1.8 to 14 solved the problem: https://scans.gradle.com/s/luo6oqxcbvfq2
b

Brais Gabin

10/07/2020, 7:21 AM
Extracted from: https://detekt.github.io/detekt/gradle.html
Copy code
plugins {
    id "io.gitlab.arturbosch.detekt" version "1.14.1"
}

repositories {
    jcenter() // jcenter is needed <https://github.com/Kotlin/kotlinx.html/issues/81>
}
The comment is important here. Extracted from the same documentation, if you want to use jcenter as least as possible (as me):
Copy code
repositories {
    mavenCentral()
    jcenter {
        content {
            // just allow to include kotlinx projects
            // detekt needs 'kotlinx-html' for the html report
            includeGroup("org.jetbrains.kotlinx")
        }
    }
}
b

BorzdeG

10/07/2020, 7:42 AM
But I am using jcenter. And didn’t change anything in the project settings, except for the Gradle version and JDK to make it work
b

Brais Gabin

10/07/2020, 7:46 AM
That’s strange. I use gradle 6.6.1 and JDK 8
6 Views