Findbugs plugin in 1.2-rc-1 does not honor excludeFilter


(Diwaker Gupta) #1

My build.gradle contains:

apply plugin: 'findbugs'
findbugs {
    toolVersion = '2.0.1'
    effort = 'min'
    excludeFilter = file("$rootProject.projectDir/config/findbugs/excludeFilter.xml")
}

This is the same exclude filter that we use in our Maven projects and we get a clean Findbugs run. However, I got Findbugs errors with gradle. To verify if excludeFilter was being honored, I changed the contents to:

<FindBugsFilter>
<Match>
    <Package name="~.*"/>
</Match>

The above should match ALL packages and effectively exclude everything from Findbugs. Even with the above filter, I get the exact same results as before which leads me to believe that excludeFilter is not really being honored.

------------------------------------------------------------
Gradle 1.2-rc-1
------------------------------------------------------------
  Gradle build time: Tuesday, September 4, 2012 5:49:54 PM UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
Ivy: 2.2.0
JVM: 1.7.0_05 (Oracle Corporation 23.1-b03)
OS: Mac OS X 10.8.1 x86_64

(René Groeschke) #2

Hello, in gradle 1.2-rc-1 you have to define the excludeFilters per task. this means that instead of using

findbugs {
    excludeFilter = file("$rootProject.projectDir/config/findbugs/excludeFilter.xml")
}

you have to declare it explicitly for your findbugsMain task:

findbugsMain {
    excludeFilter = file("$rootProject.projectDir/config/findbugs/excludeFilter.xml")
}

This is already fixed on master

cheers, René


(Diwaker Gupta) #3

Ah of course, thanks Rene!


(Diwaker Gupta) #4

BTW, the documentation here is misleading: http://gradle.org/docs/release-candidate/dsl/org.gradle.api.plugins.quality.FindBugsExtension.html


(René Groeschke) #5

thanks for pointing this out. much appreciated!