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?
When you specify a dependency in your build script, you can provide an exclude rule at the same time telling Gradle not to pull in the specified transitive dependency. For example, say we have a Gradle project that depends on Google's Guava library, or more specifically com.
Using Command Line Flags Task :compileTestJava > Task :processTestResources NO-SOURCE > Task :testClasses > Task :test > ... To skip any task from the Gradle build, we can use the -x or –exclude-task option. In this case, we'll use “-x test” to skip tests from the build.
A variant of a component can have dependencies on other modules to work properly, so-called transitive dependencies. Releases of a module hosted on a repository can provide metadata to declare those transitive dependencies. By default, Gradle resolves transitive dependencies automatically.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With