gpt4 book ai didi

gradle - 如何在build.gradle.kts中定义变量以排除多个传递依赖项

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

我知道在基于groovy的build.gradle中,您可以按here所述定义多个排除项:

dependencies {
def withoutStuff = {
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-v13'
exclude group: 'com.android.support', module: 'design-v13'
}

// For Material Datepicker
compile deps.datePicker, withoutStuff
}

但是现在我们如何在基于kotlin的build.gradle.kts文件中执行此操作?

最佳答案

好吧,我经过大量的搜索,追踪和发现错误后才发现问题。在依赖关系上方,您可以定义:

val withoutStuff = fun ExternalModuleDependency.() {
exclude(group = "com.android.support", module = "support-v4")
exclude(group = "com.android.support", module = "support-v13")
exclude(group = "com.android.support", module = "design-v13")
}

然后在依赖项块中可以执行以下操作:
dependencies {

implementation(deps.datePicker, withoutStuff)
...
}

希望能对其他人有所帮助,并期待其他答案。

关于gradle - 如何在build.gradle.kts中定义变量以排除多个传递依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54381662/

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