Eclipse maven 错误:SLF4J(W): 未找到 SLF4J 提供程序

问题描述 投票:0回答:1

当我在命令窗口中运行时,我的测试用例正在运行。 使用命令:

mvn clean verify

但是当我直接从 Eclipse 运行时,它会抛出以下错误。

SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
SLF4J(W): Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J(W): Ignoring binding found at [jar:file:/C:/XXX/YYYY/.p2/pool/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.18.1.20211008-0657/jars/slf4j-simple-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J(W): See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.

我添加了 slf4j-api 并将 ch.qos.logback 版本更改为 1.2.11。在 Eclipse 中运行时仍然出现相同的错误:Eclipse>右键>运行为>maven build

maven run time eclipse error

java eclipse maven automation
1个回答
0
投票

logback-classic
版本
1.2.11
使用
slf4j-simple
slf4j-api
版本
1.7.32

你的 pom.xml 应该是这样的:

<dependencies>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.32</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.32</version>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.2.11</version>
        <scope>test</scope>
    </dependency>
</dependencies>
© www.soinside.com 2019 - 2024. All rights reserved.