2012-01-18 71 views
1

我正在运行findbugs和maven这个插件,然后构建失败,即使如果我运行查找错误的最大设置20通过Eclipse我得到0个错误。现在,它失败,33FindBugs的Maven

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>findbugs-maven-plugin</artifactId> 
    <version>2.0.1</version> 
    <configuration> 
     <threshold>Ignore</threshold> 
     <xmlOutput>true</xmlOutput> 
    </configuration> 
    <executions> 
     <execution> 
     <phase>verify</phase> 
     <goals> 
      <goal>check</goal> 
     </goals> 
     </execution> 
    </executions> 
    </plugin> 

两个问题:

为什么会出现在Eclipse插件FindBugs的和Maven的FindBugs的插件之间的这种差异?

我可以以某种方式使Eclipse Findbugs加载从Maven Findbugs生成的findbugscheck.xml,以便我的代码自动突出显示。通过xml文件捕鱼是非常烦人的。

回答

1

Eclipse FindBugs插件和findbugs-maven-plugin之间的差异很可能是由于这两个产品使用不同版本的Findbugs实用程序。这些产品中的每一个都运行FindBugs实用程序(found here),然后解析该实用程序的输出并显示结果。 findbugs-maven-plugin-2.0.1基于Findbugs 1.3.8。我无法说出你的Eclipse插件所基于的Findbugs的版本。

Findbugs实用程序支持一些可以影响结果的command line options(如-effort:max,-effort:min)。 Eclipse Findbugs插件和findbugs-maven插件可能会提供不同的命令行选项,导致结果不一致。如果它们都为这些命令行选项提供配置,则可以消除这种差异。

Eclipse Findbugs插件提供了Eclipse内插件视图中结果的一些过滤。过滤可以在插件的视图中作为工具栏图标访问(不是100%确定此位置,因为我目前不在我的开发箱中)。

此外,从FindBugs的website

“FindBugs的支持插件架构允许任何人添加新的缺陷检测。”

这可能意味着Eclipse插件已插入其他错误检测器,但我不知道这是这种情况,它只是一种可能性被指出。我从来没有找到一种方法让Eclipe Findbugs插件从Maven构建中加载findbugscheck.xml。

ETA:不用通过查找findbugs结果xml手工捕获,而是尝试运行Findbugs GUI并使用它来加载和查看结果。