There are currently no tools for this using the standard plugin. You can create a plugin to read findbugsChecks.xml and display the information you need.
The code below displays the common errors found and errors for each project using findbugsChecks.xml in the output directory. You can customize the name of the file that it reads by setting the findBugsChecks property in the configuration:
package name.seller.rich; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.xml.Xpp3Dom; import org.codehaus.plexus.util.xml.Xpp3DomBuilder; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; public class FindbugsStatsMojo extends AbstractMojo { private File findbugsChecks; public void execute() throws MojoExecutionException, MojoFailureException { if (findbugsChecks != null && findbugsChecks.exists()) { try { Xpp3Dom dom = Xpp3DomBuilder.build(new FileReader( findbugsChecks));
To package this code, add it to the src / main / java Mavenproject folder using POM, like this:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>name.seller.rich</groupId> <artifactId>maven-findbugs-stats-plugin</artifactId> <packaging>maven-plugin</packaging> <version>0.0.1</version> <dependencies> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-core</artifactId> <version>2.2.0</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-plugin-api</artifactId> <version>2.2.0</version> </dependency> </dependencies> </project>
Then run mvn install to install the plugin.
To actually use it, you can run it as an additional goal on the command line or associate it with your project so that it runs as part of the standard life cycle.
Here's the command to run from the command line (assuming the project has been compiled earlier:
mvn findbugs:check name.seller.rich:maven-findbugs-stats-plugin:0.0.1:stats
To bind configurations to your project so that it runs in each assembly, use the following configuration:
<build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> <version>2.1</version> <executions> <execution> <id>check</id> <phase>package</phase> <goals> <goal>check</goal> </goals> </execution> </executions> <configuration> <xmlOutput>true</xmlOutput> <xmlOutputDirectory>findbugsreports</xmlOutputDirectory> <findbugsXmlOutput>true</findbugsXmlOutput> <findbugsXmlOutputDirectory>${findbugsOutputDirectory}</findbugsXmlOutputDirectory> <debug>true</debug> <failOnError>false</failOnError> </configuration> </plugin> <plugin> <groupId>name.seller.rich</groupId> <artifactId>maven-findbugs-stats-plugin</artifactId> <executions> <execution> <id>stats</id> <phase>package</phase> <goals> <goal>stats</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
Rich seller
source share