java單元測試中,junit不報錯,但console報錯

標題

java單元測試中,junit不報錯,但console報SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.

  • 控制檯報一下3個錯誤
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的jar包
  • 在pom文件中導入就可以了
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-nop</artifactId>
       <version>1.7.2</version>
   </dependency>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章