赞
踩
在开发中,遇到jar包冲突时再正常不过的事了,有的时候,因为一点小问题,就要耽误很长的时间,严重影响开发效率,本文是通过maven命令排除jar包冲突,简单高效。
好了,废话不多说,直接上干货。
使用命令:
mvn dependency:tree -Dverbose | grep 'omitted for conflict with'
通过此命令可以查找到存在冲突的jar包。
在windows中,还可以输入:
mvn dependency:tree -Dverbose | find 'omitted for conflict with'
如果已经知道了存在冲突的jar包,直接输入(比如是 log4j ):
mvn dependency:tree -Dverbose -Dincludes=log4j:log4j
然后具体查看pom文件,修改冲突的包。
如果是两个不同的jar包依赖的包里面的可以用exclusions
和 exclusion
标签来进行剔除。
比如:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.14.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
本篇文章简单介绍了使用maven命令排除jar包冲突,由于纯手打,难免会有纰漏,如果发现错误的地方,请第一时间告诉我,这将是我进步的一个很重要的环节。
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。