我正在使用IntelliJ IDEA和gradle。

当我调用Build | Build Project命令时,

IntelliJ IDEA会这样做。

18:45:02: Executing tasks ':classes :testClasses'...

:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE

BUILD SUCCESSFUL in 0s
4 actionable tasks: 4 up-to-date
18:45:02: Tasks execution finished ':classes :testClasses'.

如何告诉IntelliJ IDEA进行:clean :test

我放入build.gralde中,
defaultTasks 'clean', 'test'

当我在控制台中执行此操作时,
$ gradle -q

最佳答案

我认为您只需要在自己的classes.dependsOn(clean)中添加classes(clean任务取决于build.gradle任务)。它应该可以解决问题。

在添加行之前:

$ ./gradlew --dry-run :classes :testClasses
:compileJava SKIPPED
:processResources SKIPPED
:classes SKIPPED
:compileTestJava SKIPPED
:processTestResources SKIPPED
:testClasses SKIPPED

添加行之后:
$ ./gradlew --dry-run :classes :testClasses
:clean SKIPPED
:compileJava SKIPPED
:processResources SKIPPED
:classes SKIPPED
:compileTestJava SKIPPED
:processTestResources SKIPPED
:testClasses SKIPPED

注意,我在命令行中执行了gradle测试,它也应该在Intellij中工作。

10-04 12:43