所有*.排除和全部.排除配置中的区别是什么。



>我想知道 all*.exclude 和 all.exclude 在配置中到底有什么区别。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属性包含项目configurations中所有configuration对象的列表。

如果你想看看它实际包含什么,你可以做:

println configurations.all.names

println configurations.all*.name

语法*.是一个时髦的特定运算符,称为 spread 运算符。您可以阅读它是如何工作的,以了解它为什么在这里起作用。

最新更新