一、重复类
解决方法:(删除其中一个包,现在流行的Java日志框架用SLF4J,所以保留这个包)
1、在IntelliJ IDEA的pom文件用“ctrl+shift+alt+U”快捷键输出pom依赖框架,找到commons-logging:commons-logging的引用,这个工程项目是spring-context在引用
2、用<exclusions>方法
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <exclusions> <exclusion> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> </exclusions> </dependency>
二、版本号冲突
[WARNING] Rule 9: org.apache.maven.plugins.enforcer.DependencyConvergence failed with message:
Failed while enforcing releasability the error(s) are [
Dependency convergence error for xxx.tc:common-zookeeper:1.1.2 paths to dependency are:
+-com.xxx.flight.inter:inter_public_data.cache:1.1.4
+-xxx.tc:qmq-client:2.0.5
+-xxx.tc:common-zookeeper:1.1.2
and
+-com.xxx.flight.inter:inter_public_data.cache:1.1.4
+-xxx.tc:qmq-client:2.0.5
+-xxx.tc.qtracer:qtracer-instrument-http:1.0.7
+-xxx.tc.qtracer:qtracer-client:1.0.7
+-xxx.tc:common-zookeeper:1.1.0
]
解决方法:
用<dependencyManagement>,选择高版本
本文介绍了如何解决Java项目中由于日志框架重复引入及版本号冲突导致的问题,提供了具体的解决方案,包括使用排除依赖和依赖管理的方法。


被折叠的 条评论
为什么被折叠?



