在開發(fā)過程中發(fā)現(xiàn)了日志沖突問題,雖然不影響運行還是想著解決一下

image.png
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/Administrator/.m2/repository/org/slf4j/slf4j-log4j12/1.7.30/slf4j-log4j12-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/Administrator/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.10.0/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
1.分析產(chǎn)生沖突的jar 以及版本
查看日志可以分析出來 是 slf4j-log4j12-1.7.30.jar 和 log4j-slf4j-impl-2.10.0.jar 產(chǎn)生了沖突
2.查找沖突版本
①那我們來尋找沖突的jar都是誰引用進來的,我們先找到pom.xml

image.png
② 讓我們點擊這個結(jié)構(gòu)樹

image.png
3.屏蔽不需要的版本
①讓我們輸入 log4j-slf4j,選擇屏蔽2.10.0這個版本

image.png

image.png
4.再次運行

image.png
Maven 插件 maven helper