diffplug / diffplug/spotless

NoClassDefFoundErrors when Gradle Configuration Cache is enabled

Aperta
#2,850 15 commenti 17 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
5.6k
Fork
559
Merge medio
1g 13h
PR unite (30g)
34

Descrizione

When the Gradle Configuration Cache is enabled, I see intermittent `java.lang.NoClassDefFoundError` for googleJavaFormat classes for tasks like ` removeUnusedImports()`, or `org.eclipse.jdt` classes when using the `eclipse()` formatter.

Spotless Gradle Plugin: 8.2.1
Gradle Wrapper: 9.3.0
Java: observed on 21 and 25

In my observations, I have only seen issues when the project has multiple modules, and only when running a command including clean. `./gradlew clean` and `./gradlew build` work in isolation, but when running `./gradlew clean build` for instance, it results in an error similar to below when running it multiple times in a row.

```
Execution failed for task ':server:spotlessJavaCheck'.
> There were 1 lint error(s), they must be fixed or suppressed.
src/main/java/com/test/Main.java:LINE_UNDEFINED removeUnusedImports(java.lang.NoClassDefFoundError) com/google/googlejavaformat/java/RemoveUnusedImports (...)
Resolve these lints or suppress with `suppressLintsFor`
```

I've attached a minimal reproduction zip:
[spotless-cache-repro-master.zip](https://github.com/user-attachments/files/25214993/spotless-cache-repro-master.zip)

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.