我怎样才能使“gradle --stacktrace”默认? [英] How can I make "gradle --stacktrace" the default?
本文介绍了我怎样才能使“gradle --stacktrace”默认?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法通过 - info
或 - stacktrace
来设置 gradle.properties
?
Is there a way I can set --info
or --stacktrace
via gradle.properties
?
我现在有一个gazillion构建脚本,最终在某个时候调用gradle,我想标准化错误处理行为。
I currently have a gazillion build scripts that end up invoking gradle at some point, and I would like to standardize the error handling behavior across the board.
推荐答案
不在 gradle.properties
中,但是在 build.gradle
本身。在构建脚本的最开始处添加以下代码片段:
Not in gradle.properties
but in build.gradle
itself. Add the following piece of code at the very beginning of the build script:
import org.gradle.logging.ShowStacktrace
gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS
throw new RuntimeException('lol')
它也可能放在初始化脚本中。
正如在评论中指出的那样,从gradle v。2.14开始:
As pointed out in the comments, from gradle v. 2.14 it will be:
gradle.startParameter.showStacktrace = org.gradle.api.logging.configuration.ShowStacktrace.ALWAYS
这篇关于我怎样才能使“gradle --stacktrace”默认?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文