Findbugs and Maven 3.x

前端 未结 3 1375
傲寒
傲寒 2021-02-14 20:28

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

相关标签:
3条回答
  • 2021-02-14 20:54

    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.)

    0 讨论(0)
  • 2021-02-14 21:01

    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.

    0 讨论(0)
  • 2021-02-14 21:14

    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> 
    
    0 讨论(0)
提交回复
热议问题