2

更新如何讓Hudson生成FindBugs報表而不會因異常而失敗?

隨着哈德森的FindBugs插件版本4.3這不再是一個問題

末更新

由於我的問題的一個例子,我試圖建立以下項目http://www.sonatype.com/books/mvnex-book/reference/multimodule.html

添加以下簡單的父/ pom.xml的

<reporting> 
    <plugins> 
    <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>findbugs-maven-plugin</artifactId> 
     <version>2.3</version> 
     <configuration> 
     <findbugsXmlOutput>true</findbugsXmlOutput> 
     <findbugsXmlWithMessages>true</findbugsXmlWithMessages> 
     <xmlOutput>true</xmlOutput> 
     </configuration> 
    </plugin> 
    </plugins> 
</reporting> 

而下面簡單天氣/ pom.xml的,但簡單的webapp/pom.xml的

<reporting> 
    <plugins> 
    <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>findbugs-maven-plugin</artifactId> 
    </plugin> 
    </plugins> 
</reporting> 

我插入下面可怕的equals方法進入班有FindBugs的產生一些問題之一(如0錯誤沒有錯誤):

public boolean equals(Object o) { return true; } 

我使用哈德森與maven2風格的項目。這項工作的目的是在簡單父POM與目標

clean site 

我得到以下異常:

[INFO] Generating "FindBugs Report" report. 
[java] Warnings generated: 2 
[INFO] ------------------------------------------------------------------------ 
[ERROR] FATAL ERROR 
[INFO] ------------------------------------------------------------------------ 
[INFO] Cannot inherit from final class 
[INFO] ------------------------------------------------------------------------ 
[INFO] Trace 
java.lang.VerifyError: Cannot inherit from final class 
at java.lang.ClassLoader.defineClass1(Native Method) 
at java.lang.ClassLoader.defineClass(ClassLoader.java:621) 
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) 
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) 
at java.net.URLClassLoader.access$100(URLClassLoader.java:56) 
at java.net.URLClassLoader$1.run(URLClassLoader.java:195) 
at java.security.AccessController.doPrivileged(Native Method) 
at java.net.URLClassLoader.findClass(URLClassLoader.java:188) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:307) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:252) 
at hudson.remoting.RemoteClassLoader$ClassLoaderProxy.fetch2(RemoteClassLoader.java:370) 
at sun.reflect.GeneratedMethodAccessor594.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:592) 
at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:274) 
at hudson.remoting.Request$2.run(Request.java:270) 
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417) 
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269) 
at java.util.concurrent.FutureTask.run(FutureTask.java:123) 
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676) 
at java.lang.Thread.run(Thread.java:595) 

版本信息:

  • 的Maven 2.2.1
  • 的Java 1.5.0_22
  • 在JBoss 4.0.5.GA內部運行的Hudson 1.341(也在1.339上找到)(在4.2.2.GA和5上有相同的錯誤.1.0.GA)
  • 的Maven插件FindBugs的2.3
  • 哈德森FindBugs的插件4.1

關於如何解決此問題的任何想法?

+0

當我第一次嘗試安裝FindBugs插件*時,有這個確切的相同的問題*昨天* ..在這裏敲我的頭認爲這是我!感謝您的快速提問和更新。 – Tim 2010-02-02 17:50:50

回答

6

根據FindBugs常見問題解答,當使用錯誤版本的Apache BCEL時會發生此問題(請參閱Q2: When I click the "Find Bugs!" button, I get a NoSuchMethodError or VerifyError)。就你而言,我懷疑maven-findbugs-plugin從JBoss獲取BCEL庫是因爲一些模糊的類加載問題。 Hudson's Jira有一些非常類似的錯誤,例如HUDSON-5134(哈德森findbugs插件也受到影響)。

我的理解是,這個問題已經出臺最近(在v1.338)和,即使有解決方法,它的哈德森錯誤(這是一個迴歸,這不是與JBoss問題)。

現在,你有IMO兩種解決方案:

  • 使用版本哈德森的前向v1.338(迴歸報道了這個版本),但使用的是舊版本,並堅持它肯定是不是真的一個可行的解決方案。
  • 使用maven-findbugs-plugin使用的版本(請參閱dependencies)刪除或替換JBoss的bcel.jar(位於server/SERVERNAME/lib)。我無法說出這將如何影響JBoss(如果將其刪除,看起來您將失去在調試模式下運行JBoss的能力,但我不能說如果您更換它,一切都會正常工作) 。

不管你會做,請創建新的JIRA問題(http://issues.hudson-ci.org/),因爲這是哈德森迴歸。他們將HUDSON-5134標記爲「無法修復」,因爲有一種解決方法,但我認爲這並不能解決JBoss庫問題,這是一個很好的解決方案(我在重複自己,但這是一個哈德森錯誤)。因此,堅持讓Hudson開發人員知道其他用戶受到這個問題的影響將會幫助整個社區(至少我希望如此)。

0

提供的其他答案更好,但可以添加一個替代方法:使用Ant或批處理文件創建不關心FindBugs步驟失敗的單獨構建步驟。哈德森插件仍可用於顯示結果。

0

正如Pascal指出的那樣,存在一個類似的bug - HUDSON-5134 - 並且該錯誤表示行爲從Hudson版本1.338開始。由於Hudson每週發佈一次,所以很難確定哪個版本引入了錯誤。我注意到有一個與Hudson version 1.337HUDSON-5048)發佈的類加載器相關的變化,我懷疑這是造成這個問題,但我沒有直接的證據。

但是這可能意味着您需要回滾到1.337或更低版​​本以避免此問題。

相關問題