Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

findbugs-maven-plugin doesn't do anything

I don't get it... I want to enable findbugs report in a Maven 3 project site and did it by adding this to my pom.xml (As described here):

<project>
  ...
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>2.4.0</version>
      </plugin>
    </plugins>
  </reporting>
  ...
</project>

Then I ran mvn site but no report is generated. Interesting thing is when I use version 2.3.1 instead then a report is generated. But 2.3.2 or 2.4.0 doesn't work. When running mvn site -X then the relevant output is this:

[DEBUG] Inside canGenerateReport..... false 
[DEBUG] canGenerate is false
[DEBUG] class org.codehaus.mojo.findbugs.FindBugsGui isMavenReport: false
[DEBUG] skip non MavenReport org.codehaus.mojo:findbugs-maven-plugin:2.4.0:gui

What is this canGenerate stuff? What's going wrong here?

like image 715
kayahr Avatar asked Jan 20 '12 09:01

kayahr


People also ask

What is FindBugs Maven plugin?

FindBugs is a static code analysis tool which identifies problems found from Java code. We can integrate FindBugs into our build process by using the FindBugs Maven plugin. This blog post identifies four typical use cases and describes how we can configure the FindBugs Maven plugin to support each use case.

How do you generate FindBugs reports?

To generate the FindBugs report as part of the Project Reports, add the FindBugs plugin in the <reporting> section of your pom. xml. Then, execute the site plugin to generate the report.

What is the use of FindBugs?

FindBugs is an open source tool used to perform static analysis on Java code. In this article, we're going to have a look at setting up FindBugs on a Java project and integrating it into the IDE and the Maven build.


1 Answers

Ah, found the problem. The project must be compiled first. Plugin version 2.3.1 triggered a compile automatically but since 2.3.2 this is no longer the case. So after a mvn clean I have to run mvn compile site to get a report.

like image 108
kayahr Avatar answered Oct 12 '22 23:10

kayahr