ktlint-gradle icon indicating copy to clipboard operation
ktlint-gradle copied to clipboard

Task :loadKtlintReporters FAILED

Open kritikapandey-jupiter opened this issue 3 years ago • 10 comments

./gradlew ktlintCheck

Task :loadKtlintReporters FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':loadKtlintReporters'.

Could not resolve all files for configuration ':ktlint'. Could not resolve org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0. Required by: project : > com.pinterest:ktlint:0.42.1 > com.pinterest.ktlint:ktlint-reporter-sarif:0.42.1 > io.github.detekt.sarif4k:sarif4k:0.0.1 > Cannot choose between the following variants of org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0:

kritikapandey-jupiter avatar Jan 19 '22 11:01 kritikapandey-jupiter

You most likely don't have a repository declared in your build.

    repositories {
        // Required to download KtLint
        mavenCentral()
    }

JLLeitschuh avatar Jan 19 '22 21:01 JLLeitschuh

It is there in repositories still giving the error

pandeykriti avatar Jan 20 '22 02:01 pandeykriti

Can you provide a build scan?

JLLeitschuh avatar Jan 25 '22 16:01 JLLeitschuh

I'm in same issue.

used version(plugin): 10.2.1(latest) gradle version: 6.6.4

` What went wrong: Execution failed for task ':loadKtlintReporters'.

Could not resolve all files for configuration ':ktlint'. Could not resolve org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0. Required by: project : > com.pinterest:ktlint:0.42.1 > com.pinterest.ktlint:ktlint-reporter-sarif:0.42.1 > io.github.detekt.sarif4k:sarif4k:0.0.1 > The consumer was configured to find a component, and its dependencies declared externally. However we cannot choose between the following variants of org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0: - commonMainMetadataElements-published - iosArm32ApiElements-published - iosArm32MetadataElements-published - iosArm64ApiElements-published - iosArm64MetadataElements-published - iosX64ApiElements-published - iosX64MetadataElements-published `

When i replaced plugin version to 8.x.x, it works fine without error. Is there detail version compatibilty table?

4orty avatar Feb 09 '22 07:02 4orty

I get same issue. It stalls for a very long time, seems like either a thread lock or it's hanging after silently failing a repo fetch. gradle 7.4.2 AGP 7.0.1 ktlint-gradle 10.3.0 ktlint.version set to 0.45.2

Rolling ktlint-gradle back to 10.2.1 resolves it.

ConorGarry avatar Jun 01 '22 11:06 ConorGarry

Similar issue with 7.5 & the plugin at 8.x, 10.2.1, 10.3.0

on edit, have a project that is at 7.4.1 and 10.2.1 where this does not happen. Which suggests to me a third library introducing complications in dependency resolution, or, a minor version conflicting with a given minor version. Or possibly something else entirely

nathanshurte avatar Aug 16 '22 19:08 nathanshurte

same issue :

id("org.jlleitschuh.gradle.ktlint") version "12.0.2"} kotlin_version = "1.8.21"

`* What went wrong: Execution failed for task ':loadKtlintReporters'.

Could not resolve all files for configuration ':ktlintReporter'. Could not resolve io.github.oshai:kotlin-logging:5.1.0. Required by: project : `

nininea avatar Dec 26 '23 10:12 nininea

same issue :

id("org.jlleitschuh.gradle.ktlint") version "12.0.2"} kotlin_version = "1.8.21"

`* What went wrong: Execution failed for task ':loadKtlintReporters'.

Could not resolve all files for configuration ':ktlintReporter'. Could not resolve io.github.oshai:kotlin-logging:5.1.0. Required by: project : `

which version of gradle are you using? are you using AGP?

wakingrufus avatar Jan 18 '24 22:01 wakingrufus

Just to add my two pence - I just had this problem where I was mistakenly applying Ktlint to a module that didn't have a Kotlin plugin applied. So to fix, add a:

plugins {
  kotlin("android") // or "jvm", whatever
}

at the top of your build file, or just remove Ktlint if it's not relevant for the module.

jonapoul avatar Jan 28 '24 10:01 jonapoul

same issue :

id("org.jlleitschuh.gradle.ktlint") version "12.0.2"} kotlin_version = "1.8.21"

`* What went wrong: Execution failed for task ':loadKtlintReporters'.

Could not resolve all files for configuration ':ktlintReporter'. Could not resolve io.github.oshai:kotlin-logging:5.1.0. Required by: project : `

which version of gradle are you using? are you using AGP?

classpath 'com.android.tools.build:gradle:8.2.0'

nininea avatar Feb 01 '24 08:02 nininea