我有一个带阴影的可执行.jar,其中包含一个嵌入式Jetty服务器。我只有一个版本的SLF4J (1.6.1)作为依赖项,但是,当使用maven shade插件对.jar进行着色时,SLF4J将其视为具有多个绑定,因为依赖项同时打包在类路径和.jar的根目录中
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构建来删除重复的内容?
发布于 2013-07-04 00:07:03
修改您的POM,使您的依赖项根本不会拉出SLF4J。希望他们都会对类路径中已有的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>https://stackoverflow.com/questions/17451790
复制相似问题