gpt4 book ai didi

gradle - 配置中的all * .exclude和all.exclude有什么区别

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

我想知道当您想排除依赖项时,all。*。exclude和all.exclude在configuration.all中到底有什么区别

configurations.all {
all.exclude
all*.exclude group: 'org.json', module: 'json'
}

最佳答案

正确的语法是:

使用all方法

configurations.all {
exclude group: 'org.json', module: 'json'
}

要么

使用 all属性
configurations {
all*.exclude(group: 'org.json', module: 'json')
}
all属性保存项目 configuration 中所有 configurations 对象的列表。

如果要查看其实际包含的内容,可以执行以下操作:
println configurations.all.names

要么
println configurations.all*.name

语法 *.是特定于Groovy的运算符,称为 spread operator。您可以阅读该方法的工作原理,以了解其工作原理。

关于gradle - 配置中的all * .exclude和all.exclude有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57506009/

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