使用插件 spring-boot-maven-plugin 报Failed to load class Sl4j错误

今天编译时出现了一个错误提示,无法load StaticLoggerBinder, 就使用了默认的实现

[INFO] --- spring-boot-maven-plugin:2.1.0.RELEASE:repackage (repackage) @ nettyServer ---
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

slf4j官网说是不知道使用哪个slf4j,声明一下就好了,但是我在依赖中添加了声明也没用

                    <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-nop</artifactId>
                        <version>1.7.25</version>
                    </dependency>
阅读 2.9k
1 个回答

知道怎么修复这个问题了,插件的依赖要写在插件里面

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-nop</artifactId>
                        <version>1.7.25</version>
                    </dependency>
                </dependencies>
            </plugin>

 1. 列表项目
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题