slf4j version conflict while building through the maven.pdf...

  • No School
  • AA 1
  • 2

This preview shows page 1 out of 2 pages.

Unformatted text preview: 2 1 help Dismiss Announcing Stack Overflow Documentation We started with Q&A. Technical documentation is next, and we need your help. Whether you're a beginner or an experienced developer, you can contribute. I want to help → slf4j version conflict while building through the maven? I realised that one of my code uses slf4j 1.5.8 and the hibernate uses slf4j 1.6 jar files .. while building using maven it downloads both jars but i guess the class files of 1.5.8 is used. So when i run the program i get following error : SLF4J: The requested version 1.5.8 by your slf4j binding is not compatible with [1.6] in pom.xml i have put <dependencyManagement> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j‐api</artifactId> <version>1.6.1</version> </dependency> </dependencyManagement> The 1.5.8 is part of dependency so its downloaded on its own. This is my first experience with maven .. Let me know what should be done. java maven slf4j edited Jun 15 '12 at 15:22 zellus 8,772 Do you clean first? – Jeremy Heiler Mar 29 '11 at 19:51 yes i do mvn clean install – harshit Mar 29 '11 at 20:00 harshit 5 3 Answers As you discovered yourself, there are two libraries (Hibernate and some other) transitively importing SLF4J in two different versions. Unfortunately the older version is being picked up by maven (there are some rules which dependency should be chosen by maven in this situation). The solution is to add the exclusion in the dependency that imports older version of SLF4J ( com.example:foo‐bar is example here): <dependency> <groupId>com.example</groupId> <artifactId>foo‐bar</artifactId> <version>1.2.3</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j‐api</artifactId> </exclusion> </exclusions> </dependency> If you still experience this problem, issue: asked Mar 29 '11 at 19:39 27 50 2,937 12 49 85 $ mvn dependency:tree Look for 1.5.8 version and exclude it from all libraries importing it. answered Mar 29 '11 at 20:03 Tomasz Nurkiewicz 203k 29 455 507 this workd and thanks for the mvn dependency :tree , it helped me to find which jars were conflicting – harshit Mar 30 '11 at 1:44 3 Excluding is quite unnecessary. Instead, explicitly include the slf4j­api with the desired version in your projects pom file. That's it! – Ceki Mar 30 '11 at 7:24 Excluding is quite unnecessary and maybe quite misleading. Instead, explicitly include the slf4j­ api with the desired version in your projects pom file. That's it! This approach takes advantage of Maven's transitivity rules: the nearest dependency declaration wins. edited Mar 16 at 17:40 answered Mar 29 '11 at 21:23 Ceki 14.3k 4 37 1 This doesn't work for me: I have to exclude the transient dependency so I can specify my own. – end­user Oct 28 '11 at 13:51 3 @Ceki could you comment on end­user's experience? Should this be possible without excluding? – Traveler Sep 9 '12 at 16:08 It may be unnecessary but its documentation, it shows the users that you've altered a library that your other library expects. If theres an error there then it is clearer. – Wes Mar 16 at 10:44 You are making assumptions which maybe incorrect, in particular you are not excluding a specific version whereas with my proposal you are including a specific version. – Ceki Mar 16 at 17:39 you can exclude the wrong version with something like this: <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate</artifactId> <version>3.2.7.ga</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j‐api</artifactId> </exclusion> </exclusions> </dependency> answered Mar 29 '11 at 20:02 Ignacio Galmarino 1 Fine but OP says that Hibernate imports correct SLF4J 1.6.1 version, so it is the other library that requires exclusion. – Tomasz Nurkiewicz Mar 29 '11 at 20:04 58 ...
View Full Document

  • Fall '19
  • Prime number, Green Line, Tomasz Nurkiewicz, slf4j version conflict

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes