Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jar SLF4J多重绑定着色_Jar_Slf4j - Fatal编程技术网

Jar SLF4J多重绑定着色

Jar SLF4J多重绑定着色,jar,slf4j,Jar,Slf4j,我有一个带阴影的可执行文件.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

我有一个带阴影的可执行文件.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.`

是否有任何方法可以消除此消息或修改my maven build以删除重复项?

修改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>

org.quartz-scheduler
石英
2.1.7
slf4j api
org.slf4j