MVN package 时 SLF4J: Class path contains multiple SLF4J bindings 错误解决办法

编译通过,打包时报如下错误 :

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/Administrator/.m2/repository/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/Administrator/.m2/repository/org/slf4j/slf4j-log4j12/1.7.21/slf4j-log4j12-1.7.21.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 [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

先把工程的pom.xml里面对org.slf4j的依赖注释掉,然后重新打包


   org.slf4j
   slf4j-log4j12
   1.7.21
   test
-->

如果还是报错, 则在工程目录下用     mvn dependency:tree -P profile > dep.txt  把工程的依赖关系导出为文件,

在文件中查找对slf4J和log4j库的依赖关系,把它排除掉不打包即可。


   
      org.springframework.boot
      spring-boot-starter-logging
   
   
      org.slf4j
      slf4j-log4j12
   
   
      log4j
      log4j
   




你可能感兴趣的:(MVN package 时 SLF4J: Class path contains multiple SLF4J bindings 错误解决办法)