[英]Maven with Findbugs
我正在使用此插件運行findbugs和maven,然后構建失敗,即使我通過Eclipse運行最大設置為20的find bug,我也得到了0 bug。 現在它以33失敗。
<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文件釣魚非常煩人。
Eclipse Findbugs插件和findbugs-maven-plugin之間的差異可能是由於這兩種產品使用了不同版本的Findbugs實用程序。 這些產品中的每一個都運行FindBugs實用程序( 在此處找到 ),然后解析該實用程序的輸出並顯示結果。 findbugs-maven-plugin-2.0.1基於Findbugs 1.3.8。 我不能說您的Eclipse插件基於哪個版本的Findbugs。
Findbugs實用程序支持一些命令行選項 (例如-effort:max,-effort:min),這些選項可能會影響結果。 Eclipse Findbugs插件和findbugs-maven-plugin可能會提供不同的命令行選項,從而導致結果不一致。 如果它們都提供了這些命令行選項的配置,則可能消除這種差異。
Eclipse Findbugs插件在Eclipse內部的插件視圖中提供了一些結果過濾。 可以在插件視圖中以工具欄圖標訪問過濾(不確定此位置的100%,因為我目前不在開發框中)。
另外,從Findbugs 網站 :
“ FindBugs支持一種插件架構,允許任何人添加新的錯誤檢測器。”
這可能意味着Eclipse插件已經插入了其他錯誤檢測器,但是我不知道是這種情況,只是指出了一種可能性。 我從未找到一種方法來讓Eclipe Findbugs插件從Maven構建中加載findbugscheck.xml。
ETA:您可以嘗試運行Findbugs GUI並使用它來加載和查看結果,而不是手工遍歷findbugs結果xml。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.