每当我启动基于SpringBoot的应用程序(作为Maven build / goal 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绑定,其中一个应该去掉其中一个。我找到了misc。对相同错误的描述,其中一些还解释了如何定位(通常是可传递的)依赖关系,然后从pom中的依赖关系中排除其中一个。
我试过了,这些建议对我都不起作用!此外,Eclipse Maven: SLF4J: Class path contains multiple SLF4J bindings中提出的解决方案(即使用外部Maven安装)也不起作用!
仔细看看警告中列出的路径,我会声称,eclipse本身中已经有两个绑定(在插件org.eclipse.osgi中...这可能解释了为什么我的尝试是徒劳的:破坏应用程序的pom不会改变关于这些org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar)内部绑定的任何东西。前面提到的append得出了相同的结论:这是eclipse中的一个bug。
但有谁知道需要什么才能摆脱这一警告呢?我对各种“黑客”都持开放态度!例如,能不能让m2e.maven.runtime的jar不再包含org/slf4j/impl/StaticLoggerBinder.class (或者更确切地说,它包含了jar)?或者有没有更好/更安全的方法?在Eclipse中需要什么来消除这个警告?
发布于 2020-10-25 00:26:20
对我来说,Eclipse Maven: SLF4J: Class path contains multiple SLF4J bindings工作。在Debian Linux中,我将/usr/share/maven添加到Window/Preferences/Maven/Installations,这些警告就消失了。
https://stackoverflow.com/questions/64435319
复制相似问题