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

**URL:** <https://discuss.gradle.org/t/findbugs-task-ignores-excludes-property-set-via-exclude-method/1488>\
**Category:** Old Forum Archive\
**Created:** [February 26, 2014, 11:21am UTC](https://discuss.gradle.org/t/findbugs-task-ignores-excludes-property-set-via-exclude-method/1488 "2014-02-26T11:21:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Markus\_Wustenberg](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/markus_wustenberg/32/396_2.png) [@Markus\_Wustenberg](https://discuss.gradle.org/u/Markus_Wustenberg)\
**Post date:** [February 26, 2014, 11:21am UTC](https://discuss.gradle.org/t/findbugs-task-ignores-excludes-property-set-via-exclude-method/1488/1 "2014-02-26T11:21:00Z")

</div>

Hi there,

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

```gradle
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](https://github.com/markuswustenberg/jsense/commit/45fa6164943d85f6390cb8ad258c2b35cf09b125)

Thanks!

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [February 26, 2014, 11:34am UTC](https://discuss.gradle.org/t/findbugs-task-ignores-excludes-property-set-via-exclude-method/1488/2 "2014-02-26T11:34:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Markus\_Wustenberg](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/markus_wustenberg/32/396_2.png) [@Markus\_Wustenberg](https://discuss.gradle.org/u/Markus_Wustenberg)\
**Post date:** [February 26, 2014, 11:58am UTC](https://discuss.gradle.org/t/findbugs-task-ignores-excludes-property-set-via-exclude-method/1488/3 "2014-02-26T11:58:00Z")

</div>

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](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.
