一尘不染必须靠什么?

问题描述 投票:0回答:1

我将

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
? 我宁愿在集成测试之前运行得一尘不染。

gradle dependencies gradle-plugin spotless
1个回答
0
投票

我有

include '**/*.java'
,现在我添加了
exclude '**/build/generated/**'
以防止一尘不染地查看生成的代码。所以@Simon Jacobs的回答在一定程度上有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.