9

Has anyone managed to get findbugs 2.3.1, 2.3.2-SNAPSHOT or 2.4-SNAPSHOT to work with a Maven 3.x project?

I always end up with:

[ERROR] Failed to execute goal org.codehaus.mojo:findbugs-maven-plugin:2.4-SNAPSHOT:findbugs (default-cli) on project cular-db: An error has occurred in FindBugs Report report generation. Could not find matching constructor for: org.codehaus.mojo.findbugs.FindbugsReportGenerator(org.codehaus.doxia.module.xhtml.XhtmlSink, java.util.PropertyResourceBundle, java.io.File, org.apache.maven.doxia.tools.DefaultSiteTool)

I tried all the latest possible versions. It does not matter if I use findbugs:fingbugs or only the site goal. It is specified with

    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>findbugs-maven-plugin</artifactId>
      <version>${findbugs.version}</version>
      <configuration>
        <threshold>High</threshold>
        <effort>Default</effort>
      </configuration>
    </plugin>
2

3 Answers 3

12

On 2011/03/20, Findbugs 2.3.2 was been released, with Maven 3 support.

Announcement

Release Notes

This means that you should be able to use the latest non-snapshot version of the plugin (version 2.3.2 or later) with Maven 3.

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>findbugs-maven-plugin</artifactId>
  <version>2.3.2</version>
</plugin> 
1

As I said in the comment you should use findbugs version 2.3.2-SNAPSHOT with Maven 3. I started a project with using maven-quickstart-archetype and executed mvn findbugs:findbugs and the reports are generated successfully without any problems.

[INFO] ****** FindBugsMojo execute *******
[INFO] Inside canGenerateReport..... false
[INFO] Inside canGenerateReport..... skip false, classFilesDirectory.exists() true
[INFO] canGenerate is true
[INFO] ****** FindBugsMojo executeReport *******
[INFO] Temp File is /home/umut/noinstall/dummy/target/findbugsTemp.xml
[INFO] Fork Value is true
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:56.550s
[INFO] Finished at: Mon Jan 10 11:05:13 PST 2011
[INFO] Final Memory: 9M/55M
[INFO] ------------------------------------------------------------------------

The following is the my pom.xml.

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.dummy</groupId>
    <artifactId>dummy</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>dummy</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <pluginRepositories>
        <pluginRepository>
            <id>codehaus.snapshots</id>
            <url>http://snapshots.repository.codehaus.org</url>
        </pluginRepository>
    </pluginRepositories>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>2.3.2-SNAPSHOT</version>
                <configuration>
                    <threshold>High</threshold>
                    <effort>Default</effort>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

BTW you are right it is not working with 2.3.1 but I did not try 2.4-SNAPSHOT.

1

Just a short note for anyone with the same problem: My experience is that it does work with 2.3.2-SNAPSHOT but not with 2.4-SNAPSHOT. (2.4-SNAPSHOT causes the same error.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.