Zhe*_*Zhe 8 java eclipse maven
尝试作为 Maven Build 运行时出现此错误。有人可以帮我解决绑定冲突,谢谢。
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]
Run Code Online (Sandbox Code Playgroud)
Sag*_*khe 12
这不是 eclipse 中的错误。我们只需要从“Eclipse 的 Maven 集成”中卸载 slf4j,这是一个已经安装在 Eclipse 上的附加软件。您可以在 eclipse 市场中看到这一点。
执行以下步骤:


现在,您可以在执行 maven 构建时检查 slf4j 绑定错误是否消失。享受!
小智 5
这似乎是 Eclipse 2020-09 版本之前的一个错误。我也得到了这个。
比照。https://bugs.eclipse.org/bugs/show_bug.cgi?id=506676。
到目前为止我所知道的没有解决办法。使用项目的 Maven 依赖项无法解决问题,因为它是由 m2e 插件和 eclipse 引起的,因此它超出了项目的范围,它位于 IDE 内部。:-(
这是 Eclipse 中的一个已知错误。一种解决方法是,单独安装 Maven(不使用 Eclipse 嵌入式 Maven 二进制文件)。
然后您可以在以下位置选择外部 Maven 二进制文件:
Window->Preferences->Maven->Installations
我在这里使用的是 Windows,但在 Linux 中是相同的过程。从包管理器安装 maven(例如 sudo apt install maven),然后在 Eclipse 中激活它。
PS:在您的系统上安装 Maven 后,该命令mvn dependency:tree也将起作用。
我建议使用 Maven 依赖树插件。从文件所在项目的根级别运行以下命令pom.xml:
mvn dependency:tree
Run Code Online (Sandbox Code Playgroud)
您可以对输出进行搜索/grep,以slf4j查看哪些库引入了slf4j依赖项,以及引入了哪些版本。还可以使用 GAV 坐标进一步限制命令行的输出。然而,我经常发现查看整个树很有用,如果没有其他原因,我可以确定我看到了项目中的每个依赖项。如果你能做到这一点,那么你就已经成功了一半。
下一步是如何处理引入不需要的slf4j传递依赖项的依赖项。您可以按照此 Stack Overflow 问题并在 POM 文件中使用如下所示的内容从这些依赖项中排除: slf4j
<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>
Run Code Online (Sandbox Code Playgroud)
slf4j您可能必须添加多个排除项才能删除除您真正想要包含的一个依赖项之外的所有依赖项。作为健全性检查,您可以再次运行依赖树,以验证您的构建中只有一个实现。
| 归档时间: |
|
| 查看次数: |
5252 次 |
| 最近记录: |