spotbugs / spotbugs-maven-plugin

Maven Mojo Plug-In to generate reports based on the SpotBugs Analyzer
https://spotbugs.github.io/spotbugs-maven-plugin/
Apache License 2.0
69 stars 51 forks source link

Spotbugs 3.1.9 - No SLF4J providers were found #98

Closed zman0900 closed 5 years ago

zman0900 commented 5 years ago

Running spotbugs:check with spotbugs 3.1.9 causes an SLF4J error to be printed:

[INFO] --- spotbugs-maven-plugin:3.1.9:spotbugs (spotbugs) @ <project> ---
[INFO] Fork Value is true
     [java] SLF4J: No SLF4J providers were found.
     [java] SLF4J: Defaulting to no-operation (NOP) logger implementation
     [java] SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.
     [java] Warnings generated: 10
[INFO] Done SpotBugs Analysis....

It appears all the same messages are otherwise still printed, so this seems to just be an annoyance.

Overriding the plugin's dependency on spotbugs to 3.1.8, or adding a dependency to the plugin on org.slf4j:slf4j-simple works around the problem.

hazendaz commented 5 years ago

@zman0900 This was introduced as a transient dependency of spotbugs at 3.1.9. I'm adding a patch to slf4j-simple for 3.1.10.

hazendaz commented 5 years ago

Version 3.1.10 has been released and will be in central within next 2 hours.

linusjf commented 4 years ago

I'm receiving the same error while running spotbugs from the command line. I'm using spotbugs-4.0.0-beta4.jar.

Additionally, I'm unable to generate an output XML file using a directory.

It's generating the analysis and outputting it to the specified output file but there's no XML output. Is this the one that provides the line numbers? Using spotbugs for the first time.

https://github.com/Fernal73/LearnJava/blob/master/spotbugs

https://github.com/Fernal73/LearnJava/blob/master/spotbugs.cp

The above is my script and classpath.

Edit: Adding nop jar to classpath fixed the warning. Still need help with output XML. Removing sortByClasses resolves the issue. https://github.com/spotbugs/spotbugs-gradle-plugin/issues/114#issuecomment-555819667 http://www.slf4j.org/codes.html

Using slf4j-log4j12.jar (downloaded from maven repository) throws an exception while running spotbugs. It can't find systemProperties.properties (apparently).

hazendaz commented 4 years ago

@Fernal73 I think you would want to open an upstream issue with spotbugs directly. I long since fixed this in the plugin by forcing it to use slf4j simple. Information you have provided here indicates not using the maven plugin.

linusjf commented 4 years ago

OMG!!

I forgot about this bug completely and what I did to remedy it on my installation. How could I not share this with you?

Let me check out what's been done since and open an issue on the main repo, if needed.