簡體   English   中英

Findbugs和Maven 3.x

[英]Findbugs and Maven 3.x

有沒有人設法使用findbugs 2.3.1,2.3.2-SNAPSHOT或2.4-SNAPSHOT來處理Maven 3.x項目?

我總是最終得到:

[錯誤]無法執行目標org.codehaus.mojo:findbugs-maven-plugin:2.4-SNAPSHOT:項目cular-db上的findbugs(default-cli):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>

在2011/03/20,Findbugs 2.3.2已經發布,Maven 3支持。

公告

發行說明

這意味着您應該能夠使用Maven 3的最新非快照版本的插件(版本2.3.2或更高版本)。

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

正如我在評論中所說,你應該使用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

對於有同樣問題的人來說,這只是一個簡短的說明:我的經驗是它確實可以使用2.3.2-SNAPSHOT不適用於2.4-SNAPSHOT 2.4-SNAPSHOT導致相同的錯誤。)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM