gpt4 book ai didi

variables - gradle fileTree具有可变目录

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

我不确定fileTree是否支持此功能。我搜索了文档,所有示例均使用了具体(绝对或相对)路径。这就是我要做的。

ext {
externalProjectRoot "c:/AnotherProject"
}

implementation fileTree(dir: ${externalProjectRoot}/lib', include: '*.jar')

如果执行以下操作,则可以正常工作。
implementation fileTree(dir: 'c:/AnotherProject/lib', include: '*.jar')

因此,我怀疑fileTree函数不支持dir属性的变量。如果没有,我还有什么其他选择?

谢谢!

最佳答案

您需要使用"而不是':

更换

implementation fileTree(dir: '${externalProjectRoot}/lib', include: '*.jar')


implementation fileTree(dir: "${externalProjectRoot}/lib", include: '*.jar')

在此答案中查看有关使用'和'之间的区别的更多解释: Gradle Single vs Double Quotes:

Gradle build scripts are written in Groovy. Groovy has both double-quoted and single-quoted String literals. The main difference is that double-quoted String literals support String interpolation

关于variables - gradle fileTree具有可变目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52973144/

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