Findbugs task ignores "excludes" property set via "exclude" method

Hi there,

in the following code, I’m setting an exclude pattern for all Findbugs tasks, but it doesn’t seem to work:

tasks.withType(FindBugs) {
  exclude '**/org/jsense/serialize/protobuf/gen/*'
}

The relevant classes are still included.

I believe this is a bug. Note that using the exact same syntax for both the Checkstyle and PMD plugin works, so I don’t think it’s an issue with my project. I’ve got it to work using the “excludeFilter” property in the FindBugsExtension. Perhaps see the changes in this commit on Github for how I got it working: https://github.com/markuswustenberg/jsense/commit/45fa6164943d85f6390cb8ad258c2b35cf09b125

Thanks!

FindBugs primarily operates on class files, so you’ll have to filter those as well (see my answer to your Stack Overflow post).

Yes, thanks very much. As noted on SO as well (for good measure, a link: http://stackoverflow.com/questions/22037499/using-excludes-config-in-findbugs-and-checkstyle-plugin-in-gradle), I think this is rather counter-intuitive. Perhaps it could be made explicit in the documentation that exclusion of classes is what’s important?

But thank you for the solution, works perfectly.

1 Like