我正在使用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
答案 0 :(得分:0)
我认为您只需将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中工作。