GradleException when multiple goals leave behind spotless-clean dir
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 冷清
- 技术栈
- java
- 领域
- build-system, tooling
调研方向
首先在链接的 openapi-generator-client 项目中复现以下序列:gradle clean openApiGenerate spotlessApply,然后执行 gradle spotlessCheck 或 gradle build。检查生成的 build/spotless-clean/spotlessJava/build/generate-resources/main/src/main/java/ 目录,并将其行为与单独运行 spotlessApply 或使用显式目标时的行为进行比较;后续检查或构建无需手动清理即可成功,则表示完成。
由索引模型根据 Issue 内容生成。
描述
In my project: https://github.com/sixcorners/openapi-generator-client/tree/7b2dfb9cda3fe366f0a45f76b60b1a1961311d65
If you run
gradle clean openApiGenerate spotlessApply
it leaves behind a build/spotless-clean/spotlessJava/build/generate-resources/main/src/main/java/ directory. If you then run gradle spotlessCheck or gradle build it throws an error:
Caused by: org.gradle.api.GradleException: There were 0 lint error(s), they must be fixed or suppressed.
Resolve these lints or suppress with `suppressLintsFor`
at com.diffplug.gradle.spotless.SpotlessCheck.performAction(SpotlessCheck.java:85)
at com.diffplug.gradle.spotless.SpotlessCheck.performAction(SpotlessCheck.java:57)
if you delete build/spotless-clean or just run gradle spotlessApply again then gradle build works again.
kind of annoying but it's not a big deal.
specifying the target manually also fixes it.
spotless {
java {
googleJavaFormat()
target("src/main/java", "build/generate-resources/main/src/main/java")
}
kotlinGradle { ktfmt() }
}
I kind of thought the bug was something else but that disappeared so I kind of wonder if this can even be reproduced on other people's machines or if it will disappear too. It's also not a big deal since you can just run gradle spotlessApply in it's own cli invocation. Also running the build gradle goal in IntelliJ doesn't reproduce the issue. It's very fiddly. If you have trouble reproducing it I wouldn't mind if you just close this issue and leave it as a place for other people to find if they have something similar happen.
This is my gradle version running in a snap:
$ gradle --version
------------------------------------------------------------
Gradle 9.6.1
------------------------------------------------------------
Build time: 2026-06-26 14:25:50 UTC
Revision: 309d128bd9fe8c0b71311878fc660b9cbaa07c51
Kotlin: 2.3.21
Groovy: 4.0.32
Ant: Apache Ant(TM) version 1.10.17 compiled on April 6 2026
Launcher JVM: 25.0.3 (Ubuntu 25.0.3+9-2-26.04.2-Ubuntu)
Daemon JVM: /usr/lib/jvm/java-25-openjdk-amd64 (no Daemon JVM specified, using current Java home)
OS: Linux 7.0.0-27-generic amd64
- 主要语言
- Java
- 星标
- 5.7k
- 派生
- 560
- 平均合并
- 1 天 13 小时
- 30 天内合并 PR
- 43
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
diffplug/spotless 的其他 Issue
-
难度 5/5 一周以上 新手友好度 15/100
-
难度 5/5 一周以上 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 66/100
-
难度 3/5 1-2 天 新手友好度 68/100
-
难度 4/5 3-5 天 新手友好度 52/100
查看 diffplug/spotless 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
infinispan/infinispan#18150 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
-
untriaged
难度 2/5 1-3 小时 新手友好度 82/100
opensearch-project/k-NN#3597 ·
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
-
bug
难度 2/5 1-3 小时 新手友好度 82/100