Mastering_the_Object
Mastering_the_Object

Reputation: 1033

How do you exclude a transitive project dependency in gradle

given

dependencies {
   compile project(':subproject') {
        transitive = false
   }
}

This does not work properly in gradle 1.3. (i.e. all dependencies are included from the subproject)

Is this a bug or is there a different syntax for excluding project dependencies?

Upvotes: 16

Views: 11230

Answers (1)

Peter Niederwieser
Peter Niederwieser

Reputation: 123910

The shown syntax will add a new (so-called dynamic) transitive property to the Project object, which, unless used somewhere else, won't have any effect. You'll get a warning that dynamic properties have been deprecated, which is a sign of a potential mistake in the build script, and will fail hard in Gradle 2.0.

The correct syntax is (as you already indicated):

dependencies {
    compile(project(':subproject')) {
        transitive = false
    }
} 

Upvotes: 30

Related Questions