Noel Yap
Noel Yap

Reputation: 19758

Gradle exclusion of transitive dependencies not working

I have the following in a subprojects closure:

configurations {
    all*.exclude group: 'com.sun.jersey', module: 'jersey-bundle'
}

But gradlew dependencies is still including jersey-bundle. What needs to be done to fix this?

Upvotes: 3

Views: 2427

Answers (2)

Noel Yap
Noel Yap

Reputation: 19758

Deny and Exclude rules from Resolution Rules Plugin can be used for this purpose. It provides a way to reuse the rules so not every project in the company must know the exact incantation needed to exclude dependencies.

Upvotes: 0

Noel Yap
Noel Yap

Reputation: 19758

The problem is that at the time the configurations closure is executed, all has no configurations. Use:

configurations.all {
    exclude group: 'com.sun.jersey', module: 'jersey-bundle'
}

Upvotes: 5

Related Questions