java - 尽管存在绑定(bind)依赖性,但无法加载 StaticLoggerBinder

标签 java maven slf4j logback

我有所有必要的依赖:

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.0.13</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.5</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>jcl-over-slf4j</artifactId>
    <version>1.7.5</version>
</dependency>

但仍然在 webapp 启动时得到这个:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

它出现在 Linux 终端和 Eclipse 中。所以这与 m2e 无关。

这是 mvn dependency:tree 的输出:

[INFO] +- org.apache.tiles:tiles-jsp:jar:3.0.1:compile
[INFO] |  +- org.apache.tiles:tiles-servlet:jar:3.0.1:compile
[INFO] |  |  +- org.apache.tiles:tiles-core:jar:3.0.1:compile
[INFO] |  |  |  \- commons-digester:commons-digester:jar:2.0:compile
[INFO] |  |  \- org.apache.tiles:tiles-request-servlet:jar:1.0.1:compile
[INFO] |  +- org.apache.tiles:tiles-template:jar:3.0.1:compile
[INFO] |  |  +- org.apache.tiles:tiles-api:jar:3.0.1:compile
[INFO] |  |  \- org.apache.tiles:tiles-autotag-core-runtime:jar:1.1.0:compile
[INFO] |  \- org.apache.tiles:tiles-request-jsp:jar:1.0.1:compile
[INFO] |     \- org.apache.tiles:tiles-request-api:jar:1.0.1:compile
[INFO] +- org.hibernate:hibernate-core:jar:4.2.7.Final:compile
[INFO] |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
[INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  +- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] |  \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.2.Final:compile
[INFO] +- org.hibernate:hibernate-validator:jar:5.0.1.Final:compile
[INFO] |  +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |  \- com.fasterxml:classmate:jar:0.8.0:compile
[INFO] +- com.sun.xml.ws:jaxws-rt:jar:2.2.8:compile
[INFO] |  +- javax.xml.bind:jaxb-api:jar:2.2.7:compile
[INFO] |  +- javax.xml.ws:jaxws-api:jar:2.2.9:compile
[INFO] |  +- javax.xml.soap:javax.xml.soap-api:jar:1.3.5:compile
[INFO] |  +- javax.annotation:javax.annotation-api:jar:1.2-b03:compile
[INFO] |  +- javax.jws:jsr181-api:jar:1.0-MR1:compile
[INFO] |  +- com.sun.xml.bind:jaxb-core:jar:2.2.7:compile
[INFO] |  |  \- com.sun.istack:istack-commons-runtime:jar:2.16:compile
[INFO] |  +- com.sun.xml.bind:jaxb-impl:jar:2.2.7:compile
[INFO] |  +- com.sun.xml.ws:policy:jar:2.3.1:compile
[INFO] |  +- org.glassfish.gmbal:gmbal-api-only:jar:3.1.0-b001:compile
[INFO] |  |  \- org.glassfish.external:management-api:jar:3.0.0-b012:compile
[INFO] |  +- org.jvnet.staxex:stax-ex:jar:1.7.1:compile
[INFO] |  +- com.sun.xml.stream.buffer:streambuffer:jar:1.5.1:compile
[INFO] |  +- org.jvnet.mimepull:mimepull:jar:1.9.1:compile
[INFO] |  +- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.12:compile
[INFO] |  +- org.glassfish.ha:ha-api:jar:3.1.9:compile
[INFO] |  +- com.sun.xml.messaging.saaj:saaj-impl:jar:1.3.20:compile
[INFO] |  |  \- javax.xml.soap:saaj-api:jar:1.3.4:compile
[INFO] |  |     \- javax.activation:activation:jar:1.1:compile
[INFO] |  +- org.codehaus.woodstox:woodstox-core-asl:jar:4.1.2:runtime
[INFO] |  +- org.codehaus.woodstox:stax2-api:jar:3.1.1:runtime
[INFO] |  \- com.sun.org.apache.xml.internal:resolver:jar:20050927:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.0.13:compile
[INFO] |  \- ch.qos.logback:logback-core:jar:1.0.13:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.5:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.5:compile
[INFO] +- org.postgresql:postgresql:jar:9.2-1003-jdbc4:compile
[INFO] +- org.springframework:spring-context:jar:3.2.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:3.2.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:3.2.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-core:jar:3.2.4.RELEASE:compile
[INFO] |  \- org.springframework:spring-expression:jar:3.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:3.2.4.RELEASE:compile
[INFO] |  \- org.springframework:spring-tx:jar:3.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:3.2.4.RELEASE:compile
[INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.2.4.RELEASE:compile
[INFO] |  \- org.springframework:spring-web:jar:3.2.4.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-core:jar:3.1.4.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-javaconfig:jar:1.0.0.M1:compile
[INFO] +- org.springframework.social:spring-social-facebook:jar:1.1.0.BUILD-SNAPSHOT:compile
[INFO] |  +- org.springframework.social:spring-social-core:jar:1.1.0.BUILD-SNAPSHOT:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.2.2:compile
[INFO] |  +- org.springframework.social:spring-social-config:jar:1.1.0.BUILD-SNAPSHOT:compile
[INFO] |  |  \- org.springframework.social:spring-social-web:jar:1.1.0.BUILD-SNAPSHOT:compile
[INFO] |  |     \- javax.inject:javax.inject:jar:1:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.2.2:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-core:jar:2.2.2:compile
[INFO] +- org.springframework.social:spring-social-twitter:jar:1.1.0.M4:compile
[INFO] |  \- org.springframework.security:spring-security-crypto:jar:3.1.4.RELEASE:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- org.webjars:bootstrap:jar:2.3.2:compile
[INFO] +- org.webjars:fancybox:jar:2.1.5:compile
[INFO] +- org.webjars:font-awesome:jar:4.0.0:compile
[INFO] +- org.webjars:jquery:jar:1.10.2:compile
[INFO] +- org.webjars:jquery-waypoints:jar:2.0.3:compile
[INFO] +- ro.isdc.wro4j:wro4j-core:jar:1.7.1:compile
[INFO] |  +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] |  \- commons-io:commons-io:jar:2.4:compile
[INFO] +- ro.isdc.wro4j:wro4j-extensions:jar:1.7.1:compile
[INFO] |  +- ro.isdc.wro4j:rhino:jar:1.7R5-20130223-1:compile
[INFO] |  +- commons-pool:commons-pool:jar:1.6:compile
[INFO] |  +- com.google.code.gson:gson:jar:1.6:compile
[INFO] |  +- com.google.javascript:closure-compiler:jar:v20130411:compile
[INFO] |  |  +- args4j:args4j:jar:2.0.16:compile
[INFO] |  |  +- com.google.guava:guava:jar:14.0.1:compile
[INFO] |  |  +- com.google.protobuf:protobuf-java:jar:2.4.1:compile
[INFO] |  |  +- org.json:json:jar:20090211:compile
[INFO] |  |  \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] |  +- com.github.lltyk:dojo-shrinksafe:jar:1.7.2:compile
[INFO] |  +- org.jruby:jruby-core:jar:1.7.4:compile
[INFO] |  |  +- org.jruby:jruby-stdlib:jar:1.7.4:compile
[INFO] |  |  +- org.jruby.joni:joni:jar:2.0.0:compile
[INFO] |  |  +- com.github.jnr:jnr-netdb:jar:1.1.2:compile
[INFO] |  |  +- com.github.jnr:jnr-enxio:jar:0.4:compile
[INFO] |  |  +- com.github.jnr:jnr-unixsocket:jar:0.3:compile
[INFO] |  |  +- com.github.jnr:jnr-posix:jar:2.5.2:compile
[INFO] |  |  +- org.jruby.extras:bytelist:jar:1.0.10:compile
[INFO] |  |  +- com.github.jnr:jnr-constants:jar:0.8.4:compile
[INFO] |  |  +- org.jruby.jcodings:jcodings:jar:1.0.10:compile
[INFO] |  |  +- com.github.jnr:jffi:jar:1.2.5:compile
[INFO] |  |  +- org.yaml:snakeyaml:jar:1.11:compile
[INFO] |  |  +- jline:jline:jar:2.7:compile
[INFO] |  |  +- joda-time:joda-time:jar:2.1:compile
[INFO] |  |  +- com.jcraft:jzlib:jar:1.1.2:compile
[INFO] |  |  +- com.headius:invokebinder:jar:1.2:compile
[INFO] |  |  \- com.github.jnr:jnr-ffi:jar:1.0.4:compile
[INFO] |  |     +- com.github.jnr:jffi:jar:native:1.2.7:runtime
[INFO] |  |     \- com.github.jnr:jnr-x86asm:jar:1.0.2:compile
[INFO] |  +- me.n4u.sass:sass-gems:jar:3.1.19:compile
[INFO] |  +- nz.co.edmi:bourbon-gem-jar:jar:2.1.0:compile
[INFO] |  +- com.github.sommeri:less4j:jar:1.1.3:compile
[INFO] |  |  +- org.antlr:antlr-runtime:jar:3.4:compile
[INFO] |  |  \- commons-beanutils:commons-beanutils:jar:1.8.3:compile
[INFO] |  +- org.codehaus.gmaven.runtime:gmaven-runtime-1.7:jar:1.3:compile
[INFO] |  |  +- org.codehaus.gmaven.feature:gmaven-feature-support:jar:1.3:compile
[INFO] |  |  |  \- org.codehaus.gmaven.feature:gmaven-feature-api:jar:1.3:compile
[INFO] |  |  +- org.codehaus.gmaven.runtime:gmaven-runtime-support:jar:1.3:compile
[INFO] |  |  |  +- org.codehaus.gmaven.runtime:gmaven-runtime-api:jar:1.3:compile
[INFO] |  |  |  +- org.sonatype.gshell:gshell-io:jar:2.0:compile
[INFO] |  |  |  +- org.codehaus.plexus:plexus-utils:jar:2.0.1:compile
[INFO] |  |  |  \- com.thoughtworks.qdox:qdox:jar:1.10:compile
[INFO] |  |  +- org.codehaus.groovy:groovy-all:jar:1.7.4:compile
[INFO] |  |  \- org.apache.ant:ant:jar:1.8.1:compile
[INFO] |  |     \- org.apache.ant:ant-launcher:jar:1.8.1:compile
[INFO] |  +- org.webjars:webjars-locator:jar:0.5:compile
[INFO] |  +- org.webjars:jshint:jar:2.1.3:compile
[INFO] |  +- org.webjars:less:jar:1.3.3:compile
[INFO] |  +- org.webjars:emberjs:jar:1.0.0-rc.5:compile
[INFO] |  +- org.webjars:handlebars:jar:1.0.0-rc.4:compile
[INFO] |  +- org.webjars:coffee-script:jar:1.6.3:compile
[INFO] |  +- org.webjars:jslint:jar:c657984cd7:compile
[INFO] |  \- org.webjars:json2:jar:20110223:compile
[INFO] +- cglib:cglib:jar:3.0:compile
[INFO] |  \- org.ow2.asm:asm:jar:4.0:compile
[INFO] +- org.ocpsoft.prettytime:prettytime-integration-jstl:jar:3.1.0.Final:compile
[INFO] +- com.github.slugify:slugify-taglib:jar:1.0-RELEASE:compile
[INFO] |  \- com.github.slugify:slugify:jar:1.0-RELEASE:compile
[INFO] |     \- commons-lang:commons-lang:jar:2.6:compile
[INFO] \- net.sf.uadetector:uadetector-resources:jar:2013.10:compile
[INFO]    \- net.sf.uadetector:uadetector-core:jar:0.9.10:compile
[INFO]       +- net.sf.qualitycheck:quality-check:jar:1.3:compile
[INFO]       \- javax.annotation:jsr250-api:jar:1.0:compile

我正在使用 tomcat7-maven-plugin 运行我的 webapp,它的目标是 tomcat7:run。如果 LogBACK 在类路径中,我不知道去哪里查看,但是在运行目标 package 并查看 WEB-INF/lib 时我可以看到 logback jar 文件创建 war 文件: enter image description here

pom.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mypage</groupId>
    <artifactId>site</artifactId>
    <version>1.0-SNAPSHOT</version>

    <packaging>war</packaging>

    <properties>

        <!-- Generic properties -->
        <java.version>1.7</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <!-- Apache Tiles -->
        <tiles.version>3.0.1</tiles.version>

        <!-- Hibernate -->
        <hibernate.version>4.2.7.Final</hibernate.version>
        <hibernate-validator.version>5.0.1.Final</hibernate-validator.version>

        <!-- JAX-WS -->
        <jaxws.version>2.2.8</jaxws.version>

        <!-- Logging -->
        <logback.version>1.0.13</logback.version>
        <slf4j.version>1.7.5</slf4j.version>

        <!-- PostgreSQL -->
        <postgresql.version>9.2-1003-jdbc4</postgresql.version>

        <!-- Spring -->
        <spring-framework.version>3.2.4.RELEASE</spring-framework.version>
        <spring-security.version>3.1.4.RELEASE</spring-security.version>
        <spring-social.facebook.version>1.1.0.M4</spring-social.facebook.version>
        <spring-social.twitter.version>1.1.0.M4</spring-social.twitter.version>

        <!-- Servlet -->
        <jstl.version>1.2</jstl.version>
        <servlet.version>3.1.0</servlet.version>

        <!-- WebJars -->
        <bootstrap.version>2.3.2</bootstrap.version>
        <fancybox.version>2.1.5</fancybox.version>
        <font-awesome.version>4.0.0</font-awesome.version>
        <jquery.version>1.10.2</jquery.version>
        <waypoints.version>2.0.3</waypoints.version>

        <!-- wro4j -->
        <wro4j.version>1.7.1</wro4j.version>

        <!-- Other -->
        <cglib.version>3.0</cglib.version>
        <prettytime.version>3.1.0.Final</prettytime.version>
        <slugify.version>1.0-RELEASE</slugify.version>
        <uadetector.version>2013.10</uadetector.version>

        <!-- Plugins -->
        <maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
        <jaxws-maven-plugin.version>2.3</jaxws-maven-plugin.version>
        <tomcat7-maven-plugin.version>2.1</tomcat7-maven-plugin.version>

    </properties>

    <repositories>

        <repository>
            <id>org.springframework.maven.milestone</id>
            <name>Spring Maven Milestone Repository</name>
            <url>http://repo.springsource.org/milestone</url>
        </repository>

    </repositories>

    <dependencies>

        <!-- Apache Tiles -->
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-jsp</artifactId>
            <version>${tiles.version}</version>
            <exclusions>
                <!-- Exclude Commons Logging in favor of LOGBack -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>${hibernate-validator.version}</version>
        </dependency>

        <!-- JAX-WS -->
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>${jaxws.version}</version>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
            <!--scope>runtime</scope-->
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${slf4j.version}</version>
        </dependency>

        <!-- PostgreSQL -->
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${postgresql.version}</version>
        </dependency>

        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring-framework.version}</version>
            <exclusions>
                <!-- Exclude Commons Logging in favor of LOGBack -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${spring-security.version}</version>
        </dependency>
        <!-- TODO: Remove this when updating to Spring Security 3.2 -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-javaconfig</artifactId>
            <version>1.0.0.M1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.social</groupId>
            <artifactId>spring-social-facebook</artifactId>
            <version>${spring-social.facebook.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.social</groupId>
            <artifactId>spring-social-twitter</artifactId>
            <version>${spring-social.twitter.version}</version>
        </dependency>

        <!-- Servlet -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${servlet.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>${jstl.version}</version>
        </dependency>

        <!-- WebJars -->
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>${bootstrap.version}</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>fancybox</artifactId>
            <version>${fancybox.version}</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>font-awesome</artifactId>
            <version>${font-awesome.version}</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery</artifactId>
            <version>${jquery.version}</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery-waypoints</artifactId>
            <version>${waypoints.version}</version>
        </dependency>

        <!-- wro4j -->
        <dependency>
            <groupId>ro.isdc.wro4j</groupId>
            <artifactId>wro4j-core</artifactId>
            <version>${wro4j.version}</version>
        </dependency>
        <dependency>
            <groupId>ro.isdc.wro4j</groupId>
            <artifactId>wro4j-extensions</artifactId>
            <version>${wro4j.version}</version>
            <exclusions>
                <!-- Exclude Commons Logging in favor of LOGBack -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Other -->
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>${cglib.version}</version>
        </dependency>
        <dependency>
            <groupId>org.ocpsoft.prettytime</groupId>
            <artifactId>prettytime-integration-jstl</artifactId>
            <version>${prettytime.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.github.slugify</groupId>
            <artifactId>slugify-taglib</artifactId>
            <version>${slugify.version}</version>
        </dependency>
        <dependency>
            <groupId>net.sf.uadetector</groupId>
            <artifactId>uadetector-resources</artifactId>
            <version>${uadetector.version}</version>
        </dependency>

    </dependencies>

    <build>

        <defaultGoal>tomcat7:run</defaultGoal>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.jvnet.jax-ws-commons</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>${jaxws-maven-plugin.version}</version>
                <configuration>
                    <packageName>de.openligadb.schema</packageName>
                    <extension>true</extension>
                    <wsdlUrls>
                        <wsdlUrl>http://www.openligadb.de/webservices/sportsdata.asmx?wsdl</wsdlUrl>
                    </wsdlUrls>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>${tomcat7-maven-plugin.version}</version>
                <configuration>
                    <path>/</path>
                </configuration>
            </plugin>

        </plugins>

    </build>

</project>

最佳答案

您可以尝试获取有关依赖关系树的详细信息:

mvn dependency:tree -Dverbose 

这将打印带有“重复问题”的依赖关系树。我怀疑是从 tiles-jsp:3.0.1 开始,详情见上:

1) 使用 apache webapp 原型(prototype)创建了一个 maven webapplication 2) 添加到 pom.xml 这些依赖项:

    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.0.13</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.5</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>1.7.5</version>
    </dependency>
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-jsp</artifactId>
        <version>3.0.1</version>
    </dependency>

3) 使用mvn dependency:tree -Dverbose打印这个:

[INFO] it.test:test:war:0.0.1-SNAPSHOT
[INFO] +- ch.qos.logback:logback-classic:jar:1.0.13:compile
[INFO] |  +- ch.qos.logback:logback-core:jar:1.0.13:compile
[INFO] |  \- (org.slf4j:slf4j-api:jar:1.7.5:compile - omitted for duplicate)
[INFO] +- org.slf4j:slf4j-api:jar:1.7.5:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.5:compile
[INFO] |  \- (org.slf4j:slf4j-api:jar:1.7.5:compile - omitted for duplicate)
[INFO] \- org.apache.tiles:tiles-jsp:jar:3.0.1:compile
[INFO]    +- org.apache.tiles:tiles-servlet:jar:3.0.1:compile
[INFO]    |  +- org.apache.tiles:tiles-core:jar:3.0.1:compile
[INFO]    |  |  +- (org.apache.tiles:tiles-api:jar:3.0.1:compile - omitted for d
uplicate)
[INFO]    |  |  +- commons-digester:commons-digester:jar:2.0:compile
[INFO]    |  |  |  \- commons-beanutils:commons-beanutils:jar:1.8.0:compile
[INFO]    |  |  \- (org.slf4j:jcl-over-slf4j:jar:1.5.8:compile - omitted for con
flict with 1.7.5)
[INFO]    |  \- org.apache.tiles:tiles-request-servlet:jar:1.0.1:compile
[INFO]    |     \- (org.apache.tiles:tiles-request-api:jar:1.0.1:compile - omitt
ed for duplicate)
[INFO]    +- org.apache.tiles:tiles-template:jar:3.0.1:compile
[INFO]    |  +- org.apache.tiles:tiles-api:jar:3.0.1:compile
[INFO]    |  |  \- (org.apache.tiles:tiles-request-api:jar:1.0.1:compile - omitt
ed for duplicate)
[INFO]    |  \- org.apache.tiles:tiles-autotag-core-runtime:jar:1.1.0:compile
[INFO]    \- org.apache.tiles:tiles-request-jsp:jar:1.0.1:compile
[INFO]       +- org.apache.tiles:tiles-request-api:jar:1.0.1:compile
[INFO]       \- (org.apache.tiles:tiles-request-servlet:jar:1.0.1:compile - omit
ted for duplicate)

4) 如果有冲突,应该使用<exclude>摆脱冲突

关于java - 尽管存在绑定(bind)依赖性,但无法加载 StaticLoggerBinder,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18239826/

相关文章:

mysql - jee maven项目的数据库路径

java - org.slf4j.simpleLogger 在启动时截断日志文件

java - 给定 ParameterizedType 和 Type,如何重新参数化第一个类型?

java - hs_err_pid.log 中的 "Events"是什么?

java - 如何将库打包为 eclipse 插件以供其他插件使用

java - Maven Shade 包含 slf4j-log4j12,尽管已明确从 POM 中排除

java - 如何为简单的 Maven 应用程序配置 slf4j 以正确显示日志?

java - 将 slider 位置更改为右侧

java - Maven 用类打包资源

java - Spring Boot Maven 插件,其依赖项中有一个主类