运行SpringBoot:SLF4J:Class路径的Eclipse包含多个SLF4J绑定



每当我启动基于SpringBoot的应用程序(以Maven构建/目标spring-boot:run运行(时,我都会收到臭名昭著的SLF4J警告:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/U:/eclipse/eclipse-jee/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:/U:/eclipse/eclipse-jee/configuration/org.eclipse.osgi/8/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]

这个警告让我非常恼火,因为当从Eclipse中降级应用程序时,潜在客户或用户看到的第一件事就是一个红色的多余警告。我讨厌那样!看起来太不专业了!

现在,原则上警告是明确的:有两个SLF4J绑定,应该去掉其中一个。我发现了错误。对同一错误的描述,其中一些还解释了如何定位(通常是可传递的(依赖项,然后从pom中的依赖项中排除其中一个。

我试过了,但这些建议对我都不起作用!中提出的解决方案Eclipse Maven:SLF4J:Class路径包含多个SLF4J绑定(即使用外部Maven安装(不起作用!

仔细观察我所声称的警告中列出的路径,eclipse本身已经有两个绑定(在插件org.eclipse.osgi…和org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar中(,这可能解释了为什么我的尝试没有结果:破坏应用程序的pom不会改变与这些eclipse内部绑定有关的任何内容。上面提到的append得出了相同的结论:这是eclipse内部的一个bug。

但是,有人知道需要什么来消除这种警告吗?我对所有类型的";黑客"!例如;按摩";这个m2e.maven.runtime.的jar不再包含org/slf4j/impl/StaticLoggerBinder.class(或者可能更确切地说,它包含的jar(?或者有更好/更安全的方法吗?需要什么来消除Eclipse中的警告?

对我来说,Eclipse Maven:SLF4J:class路径包含多个SLF4J绑定工作。在DebianLinux中,我将/usr/share/maven添加到Window/Preferences/maven/Installations中,这些警告就消失了。