Task Failures with gradle LockMode.STRICT
- Vorherrschende Sprache
- Java
- Sterne
- 5.6k
- Forks
- 559
- Ø Merge
- 1 T. 14 Std.
- Gemergte PRs (30 T.)
- 43
Beschreibung
I enabled gradle dependency locking by following https://docs.gradle.org/current/userguide/dependency_locking.html
When setting the following in the root configuration:
```kotlin
dependencyLocking {
lockAllConfigurations()
lockMode = LockMode.STRICT
}
```
I get failures when running `spotlessCheck` and `spotlessApply`:
```
> Task :spotlessKotlin FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':spotlessKotlin'.
> You need to add a repository containing the '[com.pinterest.ktlint:ktlint-cli:1.8.0]' artifact in 'build.gradle'.
E.g.: 'repositories { mavenCentral() }'
```
A workaround is to override the `lockMode` in the `spotless` configuration:
```kotlin
spotless {
configurations.compileClasspath {
dependencyLocking {
lockMode = LockMode.LENIENT
}
}
}
```
But it would be nice if it were possible to lock the ktlint version and allow running with `LockMode.STRICT` all the way :)
Beitragsleitfaden
Rechercherichtung
Beginnen Sie mit der root dependencyLocking-Konfiguration und der im Bericht gezeigten Spotless-Konfiguration. Reproduzieren Sie anschließend den Fehler mit spotlessCheck und spotlessApply unter LockMode.STRICT. Vergleichen Sie die strikten und nachsichtigen Konfigurationen und verifizieren Sie, dass die ktlint-Version gesperrt werden kann, während beide Spotless-Tasks erfolgreich abgeschlossen werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- kotlin
- Bereich
- build-system
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 55/100