“ --continue”标志的Gradle属性?

时间:2019-01-15 00:11:26

标签: java gradle groovy build.gradle

我需要能够配置gradle以使其始终使用根目录中的“ gradle.properties”或“ init.gradle”设置“ --continue”标志。甚至可能吗?如果可以,怎么办?

1 个答案:

答案 0 :(得分:1)

只需创建文件settings.gradle并添加

startParameter.continueOnFailure = true

演示build.gradle

task t1 {
 doLast {
   throw new RuntimeException("fail")
 }
}

task t2 {
 doLast {
   println "ok"
 }
}

没有以上settings.gradle

$ gradle t1 t2                                                                                                    
> Task :t1 FAILED

具有以上settings.gradle

$ gradle t1 t2
> Task :t1 FAILED

> Task :t2
ok

更多信息:

https://docs.gradle.org/current/dsl/org.gradle.api.initialization.Settings.html https://docs.gradle.org/current/javadoc/org/gradle/StartParameter.html