Gradle, How To Disable All Transitive Dependencies

Mike Rylander picture Mike Rylander · Jul 23, 2013 · Viewed 25.2k times · Source

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
}

Answer

Mike Rylander picture Mike Rylander · Jul 23, 2013

I ended up using:

configurations.all {
    transitive = false
}