Java error, Maven: SLF4J during build

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

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.

Firstly, writing to the log seems to be beautiful (it is very simple). But I don’t like the errors in my build, so I followed the URL. It says that a class can be found in one of several packages, so I added it slf4j-simpleto my dependencies. I did not know which version to use, so I got the latest version (1.7.1). The error did not disappear.

It seems that one of my dependencies (JXL) requires log4jversion 1.2.14, and that is what I need slf4j. I don’t think I can change this (right?). My thought is that perhaps the slf4jwrong version, but I do not know how to determine which version is log4jneeded.

So firstly, do I even have a problem? And secondly, even if I do not, is there a way to get rid of the warnings?

Here is the result 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 the IDE in Eclipse (Juno) using the Maven plugin (m2e). The CLI that I use for Maven is mvn clean package taomcat7:runor mvn clean install tomcat7:run. When I call Maven from the command line, I do not see the slf4j error, so maybe this is due to installation m2eor Eclipse.

+5
source share
4
+7

mvn dependency:tree , slf4j-api slf4j-simple . , SLF4J , org.slf4j.impl.StaticLoggerBinder, , slf4j-api.jar - , , ( slf4j-api.jar com. nike.dpt: : ). - , slf4j-api, , slf4j-simple.jar, -. , slf4j-api.jar lib/folder, WEB-INF/lib/ -.

? ?

+1

:

Place one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar
0

:

org.slf4j:slf4j-api:jar:1.7.1:compile
org.slf4j:slf4j-log4j12:jar:1.7.1:runtime

slf4j-api is the log API and is required at compile time, while slf4j-log4j12 is the implementation (using log4j) and it is needed at runtime.

0
source

All Articles