我必须保留两个log4j版本,以便操作系统可以根据需要使用。
我必须使用以下依赖项
我收到这个错误:
[警告]在[org. apache.log.log4j:log4j-slf4j-impl:2.14.1,org.slf4j:slf4j-log4j12:1.7.25]中发现重复和不同的类:
[警告]org.slf4j.iml.StticLoggerBinder
[警告]org.slf4j.iml.StticMDCBinder
[警告]org.slf4j.iml.StticMarkerBinder
[警告]在测试类路径中发现重复的类/资源。
[ERROR]执行目标org. basepom.maven失败:重复-finder-maven-plugin:1.2.1:在项目服务器上检查(默认):发现重复的类/资源!-
问题:
注意:第一次使用SOF,如果需要更多信息,请回复。
您必须通过mvn依赖项:tree
分析您的pom并检查哪个是依赖于log4j1的工件,然后在其中添加对违规log4j1的排除,如下所示:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>