【问题标题】:Maven throwing errors during the clean command - Eclipse/MavenMaven 在 clean 命令期间抛出错误 - Eclipse/Maven
【发布时间】:2021-02-12 00:15:01
【问题描述】:

我在 Maven 中创建了一个简单的测试项目,因为我不熟悉使用它并尝试学习。我正准备设置一个 .jar 文件,但是当我在项目中运行构建和清理时,我不断收到以下错误:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/Aaron/Downloads/Eclipse%20Installer/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:/C:/Users/Aaron/Downloads/Eclipse%20Installer/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:/C:/Users/Aaron/Downloads/Eclipse%20Installer/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:/C:/Users/Aaron/Downloads/Eclipse%20Installer/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]

究竟是什么导致了这个问题,或者我该如何解决这个问题?谢谢。

【问题讨论】:

    标签: java eclipse maven


    【解决方案1】:

    这些不是错误。 SLF4J 是一个 API,它需要一个兼容的绑定(实现)。如果没有绑定,它会写入 STDERR,它在 Eclipse 中显示为红线。

    在您的情况下,一个可能的原因是 Maven 不是从外部 JRE 运行的,而是从包含 SLF4J 的 justj JRE 插件运行的。在类路径的某处,SLF4J 找到两个或多个绑定,然后确定一个绑定,然后 Maven 顺利进行。

    如果您不喜欢看到红线,请尝试从外部 JRE 或 JDK 运行 Maven。在 Maven 启动类路径期间不会有 SLF4J。这可以通过 Maven 的“运行”配置来完成,并且可以指定另一个 JRE 或 JDK。

    【讨论】:

    • 那么,我究竟如何从外部 JRE 或 JDK 运行 Maven?你是说我错误地安装或设置了 Maven 吗?我已将主 Maven 文件夹设置到位于此处的 Java 文件夹中:C:\Program Files\Java\apache-maven-3.6.3 如果是,我应该在哪里安装或设置 Maven 文件夹。
    • Eclipse 具有内置的 Maven,并且您使用的 Eclipse 版本似乎也具有嵌入式 Java。该插件类路径中的某处是问题所在。很难解决它。也许您可以在没有 JRE 的情况下使用 Eclipse 并独立安装 JDK 并在 eclipse.ini 中包含 JDK(如果它尚未在路径上)。这将为您提供解决此问题的起点。
    【解决方案2】:

    这些只是警告,而不是错误。当文件的多个版本可用时,我们会在控制台中获得这些。您可以手动删除这些文件以删除这些警告。 JDK 会自动选择最适合使用的那个。

    这通常发生在我们更改 pom.xml 中的依赖版本时

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-20
      • 2019-03-13
      • 2016-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多