Class path contains multiple SLF4J bindings-Jar包冲突解决方案-Maven

概述

项目中经常会导致Jar包冲突问题。

问题描述

项目启动时,有如下报错:
Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/E:/myRepo/org/slf4j/slf4j-simple/1.7.25/slf4j-simple-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/E:/myRepo/org/apache/logging/log4j/log4j-slf4j-impl/2.15.0/log4j-slf4j-impl-2.15.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]

可以看到slf4j-simple-1.7.25.jar 和log4j-slf4j-impl-2.15.0.jar 这两个jar包冲突了。

解决方案

排除slf4j-simple-1.7.25.jar 这个老版本的Jar包。
在idea中可以通过maven-helper插件,查询出slf4j-simple的依赖jar包,然后排除即可。
Class path contains multiple SLF4J bindings-Jar包冲突解决方案-Maven_第1张图片

        <dependency>
            <groupId>com.test.practicegroupId>
            <artifactId>practice-sdkartifactId>
            <version>${practice-sdk.version}version>
            <exclusions>
                <exclusion>
                    <artifactId>slf4j-simpleartifactId>
                    <groupId>org.slf4jgroupId>
                exclusion>
            exclusions>
        dependency>

你可能感兴趣的:(工具,问题定位,jar,intellij-idea,maven)