views:

2936

answers:

6

You have usage: http://mojo.codehaus.org/findbugs-maven-plugin/usage.html

<project>
  [...]
  <reporting>
    [...]
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>findbugs-maven-plugin</artifactId>
      <version>1.2.1</version>
      <configuration>
        <xmlOutput>true|false</xmlOutput>
        <xmlOutputDirectory>directory location of findbugs xdoc xml report</xmlOutputDirectory>
        <threshold>High|Normal|Low|Exp|Ignore</threshold>
        <effort>Min|Default|Max</effort>
        <excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
        <includeFilterFile>findbugs-include.xml</includeFilterFile>
        <visitors>FindDeadLocalStores,UnreadFields</visitors>
        <omitVisitors>FindDeadLocalStores,UnreadFields</omitVisitors>
        <onlyAnalyze>org.codehaus.mojo.findbugs.*</onlyAnalyze>
        <pluginList>/libs/fb-contrib/fb-contrib-2.8.0.jar</pluginList>
        <debug>true|false</debug>
        <relaxed>true|false</relaxed>
        <findbugsXmlOutput>true|false</findbugsXmlOutput>
        <findbugsXmlOutputDirectory>directory location of findbugs legact xml format report</findbugsXmlOutputDirectory>
      </configuration>
    </plugin>
    [...]
  </reporting>
  [...]
</project>

But once:

mvn site

I get:

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

GroupId: org.codehaus.mojo
ArtifactId: findbugs-maven-plugin
Version: 1.2.1

Reason: Unable to download the artifact from any repository

  org.codehaus.mojo:findbugs-maven-plugin:pom:1.2.1

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)

Do you know why? What should I do?

Thanks in advance, Etam.

+1  A: 

try that:

<version>1.2</version>

http://repo2.maven.org/maven2/org/codehaus/mojo/findbugs-maven-plugin/

Seems like they did a simple copy/paste error.

Loki
+3  A: 

Looking at the repository, your version should be 1.2, not 1.2.1

Also, your configuration is wrong, you need to choose some of the options. So it should look like:

    <plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>findbugs-maven-plugin</artifactId>
  <version>1.2</version>
  <configuration>
    <threshold>High</threshold>
    <effort>Default</effort>
  </configuration>
</plugin>
Rob Di Marco
A: 

OK. Now:

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

I have:

[INFO] BUILD SUCCESSFUL

But where can I find this report? :/.

etam
A: 

The report will be in target/site. Look at the file index.html in a browser, than look for project reports, then findbugs report.

Rob Di Marco
A: 

I dont have any reports :/.

Maybe there is something with my configuration?

<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"&gt;

    <modelVersion>4.0.0</modelVersion>
    <groupId>tasktabler</groupId>
    <artifactId>tasktabler</artifactId>
    <packaging>pom</packaging>
    <version>1</version>
    <name>tasktabler</name>
    <url>http://etam.com&lt;/url&gt;

    <build>
     <plugins>
      <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-compiler-plugin</artifactId>
       <configuration>
        <source>1.5</source>
        <target>1.5</target>
       </configuration>
      </plugin>
     </plugins>
    </build>

    <modules>
     <module>commons</module>
     <module>core</module>
     <module>mpk</module>
     <module>mpk-client</module>
    </modules>

    <dependencies>
        <dependency>
           <groupId>junit</groupId>
           <artifactId>junit</artifactId>
           <version>4.3</version>
           <scope>test</scope>
        </dependency>
        <dependency>
         <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <version>1.2.8</version>
        </dependency>
    </dependencies>

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

</project>

And I am running mvn site findbugs:findbugs

etam
A: 

As part of your parent project structure place site.xml into parent-project/src/site:

 |--- src 
      |---site
            |---site.xml

An example site.xml from "Better Builds with Maven" (a free book available online) should get you started.

Once site.xml is created, execute mvn site from the parent project directory. It will pick up your reporting settings including the firebug report. Once the site is built, each child project will have directory /target/site, which contains index.html with a link to project reports. The project reports should contain firebug reports.

01es