Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Maven: SLF4J: Class path contains multiple SLF4J bindings

I got this error when trying to run as Maven Build. Could someone please help me resolve the binding conflicts, thanks.

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Applications/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/Applications/Eclipse.app/Contents/Eclipse/configuration/org.eclipse.osgi/5/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Applications/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/Applications/Eclipse.app/Contents/Eclipse/configuration/org.eclipse.osgi/5/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
like image 352
Zhe Avatar asked Aug 21 '20 07:08

Zhe


3 Answers

This is not a bug in eclipse. We just have to uninstall the slf4j from "Maven integration for eclipse" which is an additional software already installed on the eclipse. You can see this in eclipse market place.

Do the below steps:

  1. In eclipse, Go to help -> click on Market place -> click on installed. Here you will see the Maven integration for eclipse which is already installed. enter image description here
  2. Now click on change button. There you will see slf4j over logback is checked. Uncheck it and click on confirm button. This will uninstall the slf4j from "Maven integration for eclipse" software. enter image description here

Now you can check that the slf4j binding error is gone when you do the maven build. Enjoy!

like image 119
Sagar Salokhe Avatar answered Nov 14 '22 13:11

Sagar Salokhe


This is a known bug in Eclipse. A workaround is, that you install Maven separately (not using the Eclipse-embedded Maven binary).

Then you can chose that external Maven binary under: Window->Preferences->Maven->Installations

It should look like this: enter image description here

I'm using Windows here but in Linux it's the same procedure. Install maven from your package manager (e.g. sudo apt install maven), then activate it in Eclipse.

P.S: After you've installed Maven on your system, the command mvn dependency:tree will also work.

like image 28
m4110c Avatar answered Nov 14 '22 14:11

m4110c


This seems to be a bug in Eclipse up to version 2020-09. I got this as well.

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

No work around that I know of so far. Working with Maven dependencies of your project won't solve the problem since it is caused by the m2e plugin and eclipse, so it's beyond the scope of your project, it's inside the IDE. :-(

like image 21
Christoph Andriessens Avatar answered Nov 14 '22 13:11

Christoph Andriessens