Maven resolves class package dependency conflicts: mvn dependency:tree

 

When using maven to manage the dependencies of jars, conflicts between different versions of jars often occur. How to solve it?

Use the command: mvn dependency:tree to view the dependency tree structure and troubleshoot conflicting jars.

You can use the command mvn dependency:tree > dependency_tree.txt The file is better viewed with a file editor.

If a conflicting jar is found, what should I do? You can eliminate the conflict in the place, as follows:

 

<dependency>
	<groupId>org.kanpiaoxue</groupId>
	<artifactId>configcenter-bjf</artifactId>
	<version>${configcenter.version}</version>
	<!-- Eliminate conflicting jar start -->
	<exclusions>
		<exclusion>
			<groupId>org.springframework</groupId>
			<artifactId>spring</artifactId>
		</exclusion>
		<exclusion>
			<groupId>commons-httpclient</groupId>
			<artifactId>commons-httpclient</artifactId>
		</exclusion>
	</exclusions>
	<!-- exclude conflicting jar end -->
</dependency>

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326719228&siteId=291194637