java在所有项目中运行单元测试,即使有些项目失败了
我有一个多模块的Gradle项目。我希望它能够正常编译和执行所有其他任务。但是对于单元测试,我希望它能够运行所有的测试,而不是在早期项目中的一个测试失败时立即停止
我试着加上
buildscript {
gradle.startParameter.continueOnFailure = true
}
这对测试有效,但如果出现故障,编译也会继续。那不好
我是否可以将Gradle配置为仅针对测试任务继续
你可以在下面搜索框中键入要查询的问题!
我有一个多模块的Gradle项目。我希望它能够正常编译和执行所有其他任务。但是对于单元测试,我希望它能够运行所有的测试,而不是在早期项目中的一个测试失败时立即停止
我试着加上
buildscript {
gradle.startParameter.continueOnFailure = true
}
这对测试有效,但如果出现故障,编译也会继续。那不好
我是否可以将Gradle配置为仅针对测试任务继续
# 1 楼答案
在main
build.gradle
中尝试类似的方法,并让我知道,我已经用一个小的pmulti项目测试了它,并且似乎做了您需要的事情# 2 楼答案
测试失败后,我将@LazerBanana答案更改为取消下一个任务
通常所有的发布都是在所有测试之后开始的(例如,Artifactory插件就是这样做的)。因此,与其构建失败,不如添加全局任务,它将位于测试和发布(或运行)之间。 因此,您的任务顺序应该如下所示:
其他项目:
代码: