Gradle, How To Disable All Transitive Dependencies

后端 未结 3 1452
慢半拍i
慢半拍i 2020-12-15 15:23

Many of my jars have conflicting transitive dependencies (multiple spring versions). I would like to avoid inherited version conflicts by managing all of my dependencies exp

相关标签:
3条回答
  • 2020-12-15 15:41

    If you want to have just one configuration block for all configurations you can use spread-dot operator to express this.

    configurations {
        // other configurations e.g. - compile.exclude module: 'commons-logging'
        all*.transitive = false
    }
    
    0 讨论(0)
  • 2020-12-15 15:47

    In my case, I had a project (gradle module) depedency. I used the following to exclude the transitive dependencies in Gradle 3:

    implementation(project(':<module_name>')) {
        transitive = false
    }
    

    Or in Kotlin script:

    implementation(project(':<module_name>')) {
        isTransitive = false
    }
    
    0 讨论(0)
  • 2020-12-15 16:04

    I ended up using:

    configurations.all {
        transitive = false
    }
    
    0 讨论(0)
提交回复
热议问题