我将diffplug/spotless
插件添加到我的项目中,将其作为build
任务的依赖项。
tasks.build.dependsOn(tasks.integrationTest, tasks.spotlessJava
字符串
我得到以下错误:
* What went wrong:
Some problems were found with the configuration of task ':spotlessJava' (type 'SpotlessTaskImpl').
- Gradle detected a problem with the following location: 'C:\my-project'.
Reason: Task ':spotlessJava' uses this output of task ':compileTestJava' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depe
nding on what order the tasks are executed.
Possible solutions:
1. Declare task ':compileTestJava' as an input of ':spotlessJava'.
2. Declare an explicit dependency on ':compileTestJava' from ':spotlessJava' using Task#dependsOn.
3. Declare an explicit dependency on ':compileTestJava' from ':spotlessJava' using Task#mustRunAfter.
型
所以我开始添加依赖项,这在错误中显示。代码只在添加这个可怕的列表后才传递gradlew clean build
:
tasks.spotlessJava.dependsOn(tasks.quarkusGenerateCodeDev, tasks.quarkusGenerateCodeTests, tasks.processTestResources, tasks.quarkusBuild, tasks.integrationTest, tasks.prepareDeployment)
型
这真的有必要吗?为什么spotlessJava
必须依赖于integrationTest
?我宁愿在集成测试之前运行spotless。
1条答案
按热度按时间ncgqoxb01#
我有
include '**/*.java'
,现在我添加了exclude '**/build/generated/**'
来防止一尘不染地查看生成的代码。现在一尘不染的任务不使用例如quarkusGenerateCodeDev
的输出。所以@Simon Jacobs的答案在一定程度上有所帮助。