我想知道当您想排除依赖项时,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/