Search code examples
dependenciesgradletransitive-dependency

Gradle, How To Disable All Transitive Dependencies


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 explicitly, is it possible to disable all transitive dependencies in Gradle?

I know I can add transitive = false to each of my dependencies, but I am hoping there is a simpler way.

compile(group: 'org.springframework', name: 'spring', version: '2.5.2') {
    transitive = false
}

Solution

  • I ended up using:

    configurations.all {
        transitive = false
    }