【问题标题】:Gradle: How to allow only specific transitive dependencyGradle:如何只允许特定的传递依赖
【发布时间】:2019-03-26 07:24:50
【问题描述】:

我想全局禁用所有传递依赖项。我正在使用以下,它工作正常。

configurations.all {
    transitive = false
}

问题是我需要允许一个特定依赖项的传递依赖项。有没有办法做到这一点?

我尝试了以下变体,但没有成功。

compile("my:dep:xxx") {
    transitive = true
}

【问题讨论】:

    标签: gradle build.gradle dependency-management transitive-dependency


    【解决方案1】:

    试试看:

    configurations.all {
        dependencies.matching { it.group != 'my' || it.name != 'dep' }.all {
            transitive = false
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2013-11-28
      • 1970-01-01
      • 2021-01-04
      • 1970-01-01
      • 1970-01-01
      • 2013-07-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多