user447607
user447607

Reputation: 5469

Gradle global exclude

How can I exclude:

com.sun.xml.bind:*:*

from all projects, all configurations, regardless of version?

I need to replace them with:

'org.glassfish.jaxb:jaxb-xjc:2.2.11'
'org.glassfish.jaxb:jaxb-runtime:2.2.11'
...

in accordance with:

https://github.com/jacobono/gradle-jaxb-plugin/issues/15

....hmmm... Is there a way to replace them in one step?

Upvotes: 10

Views: 11727

Answers (1)

Eric Wendelin
Eric Wendelin

Reputation: 44369

According to the Gradle User Guide on Dependency Management explains, you can exclude all versions of a given dependency from all configurations:

configurations.all {
    exclude group: 'com.sun.xml.bind'
}

Then just add the glassfish dependencies (may need compile instead of runtime configuration)

dependencies {
    runtime 'org.glassfish.jaxb:jaxb-xjc:2.2.11'
    runtime 'org.glassfish.jaxb:jaxb-runtime:2.2.11'
}

Alternatively, you could try dependency substitution, but that might be hairy.

Upvotes: 15

Related Questions