2011-01-10 41 views
9

是否有人设法找到findbugs 2.3.1,2.3.2-SNAPSHOT或2.4-SNAPSHOT与Maven 3.x项目一起工作?Findbugs和Maven 3.x

我总是最后:

[错误]未能执行目标 org.codehaus.mojo:FindBugs的,Maven的插件:2.4快照:FindBugs的 (默认CLI)项目丘拉尔-db:在FindBugs Report 报告生成中发生了 错误。找不到 匹配的构造函数: org.codehaus.mojo.findbugs.FindbugsReportGenerator(org.codehaus.doxia.module.xhtml.XhtmlSink, java.util.PropertyResourceBundle, 的java.io.File, org.apache。 maven.doxia.tools.DefaultSiteTool)

我试过所有最新的可能版本。无论我使用findbugs:fingbugs还是只有网站目标都没关系。它与

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

使用的插件(2.3.2或更高版本)的最新非快照版本用-X标志运行,没有太多要说的,它只是说没有匹配的构造函数。 – 2011-01-10 18:04:41

回答

11

2011年3月20日,Findbugs 2.3.2发布,支持Maven 3。

Announcement

Release Notes

这意味着你应该能够与Maven 3

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

正如我在评论说,你应该使用FindBugs的版本2.3.2-SNAPSHOTMaven 3规定。我开始了一个使用maven-quickstart-archetype并执行mvn findbugs:findbugs的项目,报告生成顺利,没有任何问题。

[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] ------------------------------------------------------------------------ 

以下是我的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> 

顺便说一句,你是对的它不与2.3.1工作,但我没有尝试2.4-SNAPSHOT

1

只是为了有同样问题的人一个短信:我的经验是,它并与2.3.2-SNAPSHOT2.4-SNAPSHOT工作。 (2.4-SNAPSHOT导致相同的错误。)