JLLeitschuh / ktlint-gradle

A ktlint gradle plugin
MIT License
1.45k stars 159 forks source link

Task :loadKtlintReporters FAILED #567

Open kritikapandey-jupiter opened 2 years ago

kritikapandey-jupiter commented 2 years ago

./gradlew ktlintCheck

Task :loadKtlintReporters FAILED

FAILURE: Build failed with an exception.

JLLeitschuh commented 2 years ago

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

    repositories {
        // Required to download KtLint
        mavenCentral()
    }
pandeykriti commented 2 years ago

It is there in repositories still giving the error

JLLeitschuh commented 2 years ago

Can you provide a build scan?

4orty commented 2 years ago

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?

ConorGarry commented 2 years ago

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.

nathanshurte commented 2 years ago

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

nininea commented 8 months ago

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 : `

wakingrufus commented 7 months ago

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?

jonapoul commented 7 months ago

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.

nininea commented 7 months ago

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'