maven排查冲突jar包教程版

  • 113

maven排查冲突jar包

使用maven构建项目,如果项目模块比较多的话,有可能会出现jar文件冲突,如果不排查重复jar包项目就会出现编译问题。
我们排查jar文件冲突可以使用maven自带的命令,将所有依赖的jar文件打印出来,或者打印至txt文件中进行排查。

maven打印依赖包信息至文件中

在项目模块目录下使用如下命令,将依赖信息打印至tree.txt文件中。

mvn dependency:tree -Dverbose > tree.txt
搜索文件中的"conflict"可查找冲突jar文件
[INFO] +- io.springfox:springfox-swagger2:jar:2.6.1:compile
[INFO] |  +- io.swagger:swagger-annotations:jar:1.5.10:compile
[INFO] |  +- io.swagger:swagger-models:jar:1.5.10:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.1:compile (version managed from 2.4.5)
[INFO] |  |  +- (org.slf4j:slf4j-api:jar:1.7.21:compile - version managed from 1.7.10; omitted for duplicate)
[INFO] |  |  \- (io.swagger:swagger-annotations:jar:1.5.10:compile - omitted for duplicate)
[INFO] |  +- io.springfox:springfox-spi:jar:2.6.1:compile
[INFO] |  |  \- io.springfox:springfox-core:jar:2.6.1:compile
[INFO] |  |     +- (com.google.guava:guava:jar:18.0:compile - omitted for duplicate)
[INFO] |  |     +- (com.fasterxml:classmate:jar:1.3.1:compile - omitted for duplicate)
[INFO] |  |     +- (org.slf4j:slf4j-api:jar:1.7.21:compile - version managed from 1.6.3; omitted for duplicate)
[INFO] |  |     +- (org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile - omitted for duplicate)
[INFO] |  |     \- (org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile - omitted for duplicate)
[INFO] |  +- io.springfox:springfox-schema:jar:2.6.1:compile
[INFO] |  |  +- (io.springfox:springfox-core:jar:2.6.1:compile - omitted for duplicate)
[INFO] |  |  \- (io.springfox:springfox-spi:jar:2.6.1:compile - omitted for duplicate)
[INFO] |  +- io.springfox:springfox-swagger-common:jar:2.6.1:compile
[INFO] |  |  +- (io.swagger:swagger-annotations:jar:1.5.10:compile - omitted for duplicate)
[INFO] |  |  +- (io.swagger:swagger-models:jar:1.5.10:compile - omitted for duplicate)
[INFO] |  |  +- (io.springfox:springfox-spi:jar:2.6.1:compile - omitted for duplicate)
[INFO] |  |  +- (io.springfox:springfox-schema:jar:2.6.1:compile - omitted for duplicate)
[INFO] |  |  +- (io.springfox:springfox-spring-web:jar:2.6.1:compile - omitted for duplicate)
[INFO] |  |  +- (com.google.guava:guava:jar:18.0:compile - omitted for duplicate)
[INFO] |  |  +- (com.fasterxml:classmate:jar:1.3.1:compile - omitted for duplicate)
[INFO] |  |  +- (org.slf4j:slf4j-api:jar:1.7.21:compile - version managed from 1.7.10; omitted for duplicate)
[INFO] |  |  +- (org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile - omitted for duplicate)
[INFO] |  |  \- (org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile - omitted for duplicate)
[INFO] |  +- io.springfox:springfox-spring-web:jar:2.6.1:compile
[INFO] |  |  +- (com.google.guava:guava:jar:18.0:compile - omitted for duplicate)
[INFO] |  |  +- (com.fasterxml:classmate:jar:1.3.1:compile - omitted for duplicate)
[INFO] |  |  +- (org.slf4j:slf4j-api:jar:1.7.21:compile - version managed from 1.7.10; omitted for duplicate)
[INFO] |  |  +- (org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile - omitted for duplicate)
[INFO] |  |  +- (org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile - omitted for duplicate)
[INFO] |  |  \- (io.springfox:springfox-spi:jar:2.6.1:compile - omitted for duplicate)
[INFO] |  +- (com.google.guava:guava:jar:18.0:compile - omitted for ---<conflict 关键字>--- with 15.0)
[INFO] |  +- com.fasterxml:classmate:jar:1.3.1:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.21:compile

📚文章说明:
1、本文章链接失效后,请通过右下角企鹅QQ告知管理员,24小时内补链接,谢谢。点击下载说明了解。
2、天天精品分享的资源均通过网络公开合法渠道获取的,仅阅读交流测试使用,请在下载后24小时内删除。
3、版权归作者或出版社方所有,本站不对涉及的版权问题负法律责任。点击免责申明了解详情。
4、若版权方认为天天精品侵权,请联系客服QQ或发送邮件myttjp@163.com处理。
5、会员和精品豆系对搜集搬运、整理及网站运营做的友情赞助,非购买文件费用,敬请谅解。点击关于本站了解本站。
6、每位访客应尊重版权方的知识产权,支持版权方和出版社。