How to exclude transitive dependencies of a dependency?


(kevin.stembridge.dev) #1

How do I declare a dependency but exclude all of its transitive dependencies? If it makes any difference, this is in a scala project.

Thanks


(René Groeschke) #2

Hi, you can set the transitive property of a dependency to false. the example below excludes all transitive dependencies of junit:

dependencies{
 testCompile ("junit:junit:4.9"){
  transitive = false
 }
 }

regards, René


(kevin.stembridge.dev) #3

Thanks for the quick response. That works perfectly.

And I just found the documentation page that shows an example.

http://gradle.org/docs/current/dsl/org.gradle.api.artifacts.dsl.DependencyHandler.html