2013-07-03 62 views
0

我有一個陰影可執行文件.jar,其中包含一個嵌入式Jetty服務器。我只有一個版本的SLF4J(1.6.1)作爲依賴項,但是,當使用maven shade插件對.jar進行着色時,SLF4J將此視爲具有多個綁定,因爲依賴項既包裝在類路徑中,也包含在.jar的根目錄SLF4J多重綁定陰影

org 
    |_ slf4j 
    |_ ... 
WEB-INF 
    |_ lib 
    |_ slf4j-api-1.6.1.jar 
    |_ slf4j-log4j12-1.6.1.jar 

`SLF4J: Class path contains multiple SLF4J bindings. 
SLF4J: Found binding in [jar:file:/C:/Users/episner/Desktop/rmt/webapp/WEB-INF/l 
ib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/C:/Users/episner/Desktop/rmt-2.2.2-SNAPSHOT.w 
ar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.` 

是否有任何方法來抑制此消息或修改我的maven構建以消除重複?

回答

0

修改您的POM,以便您的依賴關係根本不拉SLF4J。 希望他們都會對您的classpath中已有的SLF4J版本感到滿意。沿

<dependency> 
    <groupId>org.quartz-scheduler</groupId> 
    <artifactId>quartz</artifactId> 
    <version>2.1.7</version> 
    <exclusions> 
     <exclusion> 
       <artifactId>slf4j-api</artifactId> 
      <groupId>org.slf4j</groupId> 
     </exclusion> 
    </exclusions> 
</dependency> 

東西