Search code examples
javamavenlog4jdependenciesslf4j

Java, Maven: SLF4J error during build


I'm working on a Java project and building it with Maven (m2e). When I do a mvn clean install I get this error first thing:

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.

First thing is that the logging seems to be fine (it's very basic). But I don't like errors in my build so I followed the URL. It says basically that the class can be found in one of several packages, so I added slf4j-simple to my dependencies. I didn't know which version to use, so I got the latest (1.7.1). The error didn't go away.

It seems that one of my dependencies (JXL) needs log4j version 1.2.14 and this is what needs slf4j. I don't think I can change this (can I?). My thought is that maybe the slf4j is the wrong version but I don't know how to figure out what version log4j needs.

So first, do I even have a problem? And second, even if I don't, is there a way to get rid of the warnings?

Here is the output of mvn dependency:tree:

[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ dpt ---
[INFO] com.nike.dpt:dpt:war:1.3-SNAPSHOT
[INFO] +- javax.servlet:jsp-api:jar:2.0:provided
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- javax.servlet:jstl:jar:1.2:runtime
[INFO] +- net.sourceforge.jexcelapi:jxl:jar:2.6.12:compile
[INFO] |  \- log4j:log4j:jar:1.2.14:compile
[INFO] +- commons-dbcp:commons-dbcp:jar:1.4:compile
[INFO] |  \- commons-pool:commons-pool:jar:1.5.4:compile
[INFO] +- org.springframework:spring-core:jar:3.1.2.RELEASE:compile
[INFO] |  +- org.springframework:spring-asm:jar:3.1.2.RELEASE:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-tx:jar:3.1.2.RELEASE:compile
[INFO] |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +- org.springframework:spring-aop:jar:3.1.2.RELEASE:compile
[INFO] |  \- org.springframework:spring-beans:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-aspects:jar:3.1.2.RELEASE:compile
[INFO] |  \- org.springframework:spring-context-support:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.1.2.RELEASE:compile
[INFO] |  \- org.springframework:spring-expression:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-core:jar:3.1.0.RELEASE:compile
[INFO] |  \- org.springframework.security:spring-security-crypto:jar:3.1.0.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-config:jar:3.1.0.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-web:jar:3.1.0.RELEASE:compile
[INFO] +- com.vaadin:vaadin:jar:6.8.2:compile
[INFO] +- com.google.gwt:gwt-user:jar:2.4.0:provided
[INFO] |  +- javax.validation:validation-api:jar:1.0.0.GA:provided
[INFO] |  \- javax.validation:validation-api:jar:sources:1.0.0.GA:provided
[INFO] +- org.aspectj:aspectjrt:jar:1.7.0:compile
[INFO] +- org.aspectj:aspectjweaver:jar:1.7.0:compile
[INFO] +- junit:junit:jar:4.10:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] +- org.mockito:mockito-all:jar:1.9.0:test
[INFO] +- cglib:cglib-nodep:jar:2.2.2:compile
[INFO] +- com.oracle:ojdbc14:jar:10.2.0.4.0:compile
[INFO] +- org.vaadin.addons:filteringtable:jar:0.5.3:compile
[INFO] +- org.vaadin.addons:popupbutton:jar:1.2.1:compile
[INFO] \- org.slf4j:slf4j-simple:jar:1.7.1:compile
[INFO]    \- org.slf4j:slf4j-api:jar:1.7.1:compile

I am running in the Eclipse (Juno) IDE using the Maven plugin (m2e). The CLI I am using for Maven is mvn clean package taomcat7:run or mvn clean install tomcat7:run. When I invoke Maven from a command line I do not see the slf4j error, so maybe this has to do with the m2e or Eclipse setup.


Solution

  • The error message is not related to your project. It is an m2e problem and does not cause any harm. You won't see it if you build on the command-line outside Eclipse.

    There is a bug about this but unfortunately they are rather willing to confuse peole than to fix it:

    https://bugs.eclipse.org/bugs/show_bug.cgi?id=387064