diffplug / diffplug/spotless

NoClassDefFoundErrors when Gradle Configuration Cache is enabled

オープン
#2,850 コメント 15 件 リアクション 17 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
5.6k
フォーク
559
平均マージ
1日 14時間
マージ済み PR(30日)
43

説明

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)

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

添付された最小再現をダウンロードして実行し、その後 ./gradlew clean build のような configuration-cache ビルドを繰り返して、断続的な失敗を再現します。マルチモジュールの clean ビルド全体で Spotless Gradle Plugin の formatter クラスのロードを追跡し、googleJavaFormat と eclipse() を含めて、繰り返し実行が NoClassDefFoundError なしで完了することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
build-system, tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。