gpt4 book ai didi

command-line - 子项目的gradle命令行属性

转载 作者:行者123 更新时间:2023-12-03 03:37:12 25 4
gpt4 key购买 nike

我有一个多项目gradle构建,其顶级具有以下内容:

subprojects {
apply plugin: 'war'
httpPort = hasProperty('jettyPort') ? jettyPort.toInteger() : 8080
}

如果我从命令行 gradle -PjettyPort=9000 war运行,对 hasProperty的调用将返回 null,但是如果我将 hasProperty检查移至 subprojects闭包之外,则它将返回 true

这是设计的行为,还是我可以如上所述尝试通过 subprojects闭包访问属性。

最佳答案

这样行吗?

subprojects {
apply plugin: 'war'
httpPort = project.hasProperty('jettyPort') ? jettyPort.toInteger() : 8080
}

关于command-line - 子项目的gradle命令行属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14690361/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com