在gradle脚本中,我正在创建然后启动(即exec'íng)新的gradle脚本。
在开发和调试过程中,如果我可以在启动子脚本时将某些选项(例如-i(nfo),-debug或--stacktrace)传递给子脚本,那就太好了。
有没有办法从该脚本中查询正在运行的gradle脚本的启动参数,以便将其传递给exec?我在附近搜索了一下,但没有发现任何提示。有任何想法吗?
最佳答案
我能想到的最好的是StartParameter:
StartParameter
defines the configuration used by a Gradle instance to execute a build. The properties ofStartParameter
generally correspond to the command-line options of Gradle.
您可以通过Gradle.getStartParameter()获得当前构建的实例:
project.getGradle().getStartParameter()
关于gradle - 如何在gradle脚本中访问启动参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56996214/