1. 程式人生 > >解決maven聚合專案的Class path contains multiple SLF4J bindings.問題

解決maven聚合專案的Class path contains multiple SLF4J bindings.問題

錯誤資訊:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/F:/.m2/repository/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/F:/.m2/repository/org/apache/activemq/activemq-all/5.9.0/activemq-all-5.9
.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 [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

這是包衝突造成的,從錯誤資訊來看是activemq那裡又有一個slf4j的包導致衝突。
但是我在slf4j裡面加了

<exclusions>
                <exclusion
>
<groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </exclusion> </exclusions>

也不能解決問題,原因原來是,他雖然只報了這幾個 ,但是你在eclipse的
這裡寫圖片描述
在這裡你可以看見,不知有一個包有這個依賴,因此最好的解決辦法就是,在這個頁面的右邊,右擊然後,然工具幫你去除依賴
這裡寫圖片描述


最後,完美解決,僅此記錄,後者注意。