1

I have a problem with slf4j dependencies.

On POM.xml, i declared this:

     <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.12</version>   
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>               
            </exclusion>
        </exclusions>       
    </dependency> 
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.12</version>
    </dependency>

But i meet this error message:

   SLF4J: Class path contains multiple SLF4J bindings.
   SLF4J: Found binding in               
   [jar:file:/C:/Users/r.rossi/.m2/repository/org/slf4j/slf4j-
   nop/1.5.3/slf4j-nop-1.5.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
   SLF4J: Found binding in 
   [jar:file:/C:/Users/r.rossi/.m2/repository/org/slf4j/slf4j-
    jdk14/1.5.6/slf4j-jdk14-
    1.5.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in 
    [jar:file:/C:/Users/r.rossi/.m2/repository/org/slf4j/slf4j-
    log4j12/1.7.12/slf4j-log4j12-
    1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
     SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an 
    explanation.
    SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding.
    SLF4J: Your binding is version 1.5.5 or earlier.
    SLF4J: Upgrade your binding to version 1.6.x.

On those directorties and on maven dependencies i have 1.5 versions but i don't have them on POM.xml file (as you can see), so i don't know how delete them. If i delete the directories, it works but the next esecution the project download again the 1.5 versions. How can i delete those damned 1.5 versions?

1
  • have you tried to clean your build before executing and cleaning your repository cache?
    – Nico
    Commented Jul 7, 2017 at 7:45

1 Answer 1

3

As the error stack suggest check the link Multiple Binding.
Also, check Dependency Tree to check which external dependency is trying to include (1.5.5 or earlier version). Basically, your exclusion code

<exclusions>
   <exclusion>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>               
   </exclusion>
</exclusions>

should be inserted inside that dependency which depends on an earlier version 1.5.5.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.