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

Feature/generate html reports #161

Closed frevib closed 1 year ago

frevib commented 4 years ago

Due to many requests https://github.com/spotbugs/spotbugs-maven-plugin/issues/60 https://github.com/spotbugs/spotbugs-maven-plugin/issues/150

This will add support for generating HTML reports. It already possible to generate HTML reports using the maven-site-plugin, but this cumbersome and for some (including me) the maven-site-plugin does not work properly.

Add the following XML property to generate an HTML report:

<configuration>
     <htmlOutput>true</htmlOutput>
     ...
</configuration>

The implementation is not perfect. I could use some help overcoming the "spotbugsXmlOutputFilename" property. To not break the interface we need some way generate an HTML report but with a different name than spotbugsXml.xml

I tried to create an integration test for it but I can't get the spotbugs-maven-plugin dependency to use the latest version in src/it/html-report/pom.xml. That version includes support for <htmlOutput>true</htmlOutput>

frevib commented 4 years ago

@hazendaz Could you help me a bit with the "spotbugsXmlOutputFilename" property?

hazendaz commented 4 years ago

@frevib pom.version is 'this plugin'. So during the build, it's what is in the pom of the root of the project. I'm not sure that I understand where you state it's not using the latest. When you run this it should show version of plugin used which would have been 3.1.12.x in the current point in time when you were testing here. It's now 4.0.0-SNAPSHOT. Can you rebase, test again, and post results here?

dcremonini commented 4 years ago

I just tried to run the test locally (Java12, Maven 3.6.0) and I got a success. Would it be possible to relaunch the test in Travis?

frevib commented 4 years ago

@hazendaz, is the test coverage enough now?

hazendaz commented 4 years ago

@frevib I've restarted the build but looks like prior version failed to work. It otherwise looks ok. I'd probably run some tests on it locally first myself to just confirm no issues. I totally forgot all about this one.

hazendaz commented 3 years ago

@frevib Your test is the only one failing now. Can you please rebase this against current 'spotbugs' branch and see the readme for running IT tests so you can confirm issue locally? I'll be happy to merge this once it clears in travis. Thanks.

stephen-smith commented 3 years ago

Ran into this today. mvn site doesn't work for me as a way to generate reports. The default-site provided by maven is busted, so it never even gets to invoking the plugin.

I wish requesting HTML output from the check target was as easy with this maven plugin as it is with the gradle plugin.

hazendaz commented 1 year ago

I got this to work locally but it does indicate we need to better support multiple reports so I'm going to do some separate work and then apply final patches to this at a later point soon so it can come in.

hazendaz commented 1 year ago

@frevib @stephen-smith This code has been corrected and is now merged into 'spotbugs' default branch. This will be released shortly (within week).