2014-02-07 22 views
2

我試圖用配置FindBugs的1.10

findbugs { 
    ignoreFailures = true 
    reports { 
     html { enabled = true } 
     xml.enabled = !html.enabled 
    } 
} 

配置在我的項目FindBugs的,但錯誤出現

Could not find method reports() for arguments 

[[email protected]f] 
on root project 'Project'. 

在我以前的一個項目中使用搖籃1.7和此代碼它正在工作。

回答

2

您可以在FindBugs任務上使用reports方法。 findbugs插件爲每個源集創建一個。所以,如果你想使用FindBugs的在你的主類,你可以使用

findbugsMain { 
    ignoreFailures = true 
    reports { 
     html { enabled = true } 
     xml.enabled = !html.enabled 
    } 
} 

如果你想配置所有FindBugs的任務,以同樣的方式,那麼你可以在相同的配置簡單地適用於所有的人:

tasks.withType(FindBugs) { 
    ignoreFailures = true 
    reports { 
     html { enabled = true } 
     xml.enabled = !html.enabled 
    } 
} 
+0

好吧,但在我的情況下,我有超過20個sourceSets,我想一次配置所有。 – Xelian

+1

請參閱我編輯的答案。 –

相關問題