Reputation: 2092
I have a project with a maven dependency that pulls in two packages, one of which pulls in a sub-dependency which is the same package of a lower version than the other. The dependency:tree
looks like this:
Dependency convergence error for xerces:xercesImpl:2.10.0 paths to dependency are:
+-com.vaadin:vaadin-client-compiler:7.6.4
+-net.sourceforge.nekohtml:nekohtml:1.9.19
+-xerces:xercesImpl:2.10.0
and
+-com.vaadin:vaadin-client-compiler:7.6.4
+-xerces:xercesImpl:2.11.0
The above is an output from the maven enforcer plugin where I'm enforcing dependency version convergence.
Is there a way that I can specify a version to exclude without excluding the entire sub-dependency altogether?
Upvotes: 6
Views: 15221
Reputation: 4306
Declare the net.sourceforge.nekohtml dependency in your pom.xml as a first-degree dependency, and add an exclusion to it directly.
Reference: Maven Optional and Excludes
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.19</version>
<exclusions>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
</exclusions>
</dependency>
Upvotes: 7