Delivery dependency is one of the most distinctive and convenient features of Maven, and can save a lot of configuration. such as a dependent b,b dependency C default A will also depend on C. But there are also pitfalls, such as version conflicts. Of course, MAVEN also considers the solution, you can use exclusions to exclude the corresponding repeat dependency.
But we also have a serious problem, and that is, how do I know which package is the transitive dependency of the conflict? What should we do then? Of course, MAVEN will also have a solution.
First, you add the Maven-project-info-reports-plugin plugin to the pom.xml.
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>
Maven-project-info-reports-plugin
</artifactId>
</plugin>
</reporting>
Then execute: mvn project-info-reports:dependencies. Build the reports that your project relies on so you can find dependencies on your version conflicts in your reports. If a outofmemoryerror error occurs, add parameters to the system environment maven_opts=-xmx512m
Finally, add exclusions in the corresponding dependency to exclude the related transitive dependencies.
Cases:
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.1</version>
<exclusions>
<exclusion>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
</exclusion>
</exclusions>
<scope>runtime</scope>
</dependency>
Maven exclusion resolves version conflicts in Maven delivery dependencies