# FindBugs plugin issue throwing zipException

**URL:** <https://discuss.gradle.org/t/findbugs-plugin-issue-throwing-zipexception/2010>\
**Category:** Old Forum Archive\
**Created:** [August 16, 2012, 10:19pm UTC](https://discuss.gradle.org/t/findbugs-plugin-issue-throwing-zipexception/2010 "2012-08-16T22:19:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vips](https://avatars.discourse-cdn.com/v4/letter/v/54ee81/32.png) [@vips](https://discuss.gradle.org/u/vips)\
**Post date:** [August 16, 2012, 10:19pm UTC](https://discuss.gradle.org/t/findbugs-plugin-issue-throwing-zipexception/2010/1 "2012-08-16T22:19:00Z")

</div>

I am trying to integrate findBugs plugin with my source project I have the directory structure similar to shown below /SRCROOT --build.gradle --/PROJECT1 ----/build.gradle --/PROJECT2 ----/build.gradle

I have the following thing in root project gradle script. subprojects {

apply plugin: ‘java’

apply plugin: ‘findbugs’

findbugsMain.ignoreFailures = true

findbugsTest.ignoreFailures = true . .

I am getting the following exception

Exception occured while running FindBugs. java.util.zip.ZipException: Wrong magic bytes of 3c706572 for zip file /home/sandbox/srcroot/PROJECT1/build/classes/main/META-INF/persistence.xml of 988 bytes

at edu.umd.cs.findbugs.classfile.impl.ZipFileCodeBase.(ZipFileCodeBase.java:80)

at edu.umd.cs.findbugs.classfile.impl.ZipCodeBaseFactory.countUsingZipFile(ZipCodeBaseFactory.java:90)

Any clue what is wrong here?

---

<div class="post-metadata">

**Author:** ![vips](https://avatars.discourse-cdn.com/v4/letter/v/54ee81/32.png) [@vips](https://discuss.gradle.org/u/vips)\
**Post date:** [August 16, 2012, 10:46pm UTC](https://discuss.gradle.org/t/findbugs-plugin-issue-throwing-zipexception/2010/2 "2012-08-16T22:46:00Z")

</div>

not sure… but fingbugsMain.excludes can help me here… ??

---

<div class="post-metadata">

**Author:** ![vips](https://avatars.discourse-cdn.com/v4/letter/v/54ee81/32.png) [@vips](https://discuss.gradle.org/u/vips)\
**Post date:** [August 16, 2012, 11:54pm UTC](https://discuss.gradle.org/t/findbugs-plugin-issue-throwing-zipexception/2010/3 "2012-08-16T23:54:00Z")

</div>

I tried with excludes, but doesnt seems to be working… I tried findbugsMain {

excludes = ["\*\*/\*.xml"] }

Anything wrong here?

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [August 17, 2012, 11:34am UTC](https://discuss.gradle.org/t/findbugs-plugin-issue-throwing-zipexception/2010/4 "2012-08-17T11:34:00Z")

</div>

Seems a very strange problem.

Any chance you could put together a sample project that I can use to reproduce the problem?

---

<div class="post-metadata">

**Author:** ![vips](https://avatars.discourse-cdn.com/v4/letter/v/54ee81/32.png) [@vips](https://discuss.gradle.org/u/vips)\
**Post date:** [August 17, 2012, 5:35pm UTC](https://discuss.gradle.org/t/findbugs-plugin-issue-throwing-zipexception/2010/5 "2012-08-17T17:35:00Z")

</div>

I can upload a sample project since it will take sometime, but I have found another work around… seems like the previous solution should work… but it doesn’t… So I found a workaround which seems to be working…

```gradle
def fM = findbugsMain.classes
  fM.exclude '**/*.xml'
  findbugsMain.classes = files(fM.files)

```

but there is still another problem, in which if I start a clean build, it can not find classes, and complains, and throws following exception

Caused by: org.gradle.api.InvalidUserDataException: Classes must be configured to be analyzed by the Findbugs.

at org.gradle.api.plugins.quality.internal.findbugs.FindBugsSpecBuilder.(FindBugsSpecBuilder.java:41)

at org.gradle.api.plugins.quality.FindBugs.run(FindBugs.groovy:102)

at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:196)

at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:102)

Any clue what is wrong here? these are my tasks…

```gradle
apply plugin: 'findbugs'
task runFindBugsMain(type:findbugsMain.getClass(), dependsOn:[':build']) {
  def fM = findbugsMain.classes
  fM.exclude '**/*.xml'
  fM.exclude '**/*.conf'
  fM.exclude '**/*.properties'
  fM.exclude '**/*.index'
  findbugsMain.classes = files(fM.files)
  findbugsMain.ignoreFailures = true
}
  task runFindBugsTest(type:findbugsTest.getClass(), dependsOn:[':build']) {
  def
fT = findbugsTest.classes
  fT.exclude '**/*.*'
  fT.exclude '**/*.conf'
  fT.exclude '**/*.properties'
  findbugsTest.classes = files(fT.files)
  findbugsTest.ignoreFailures = true
}

```

---

<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:** [August 20, 2012, 11:36pm UTC](https://discuss.gradle.org/t/findbugs-plugin-issue-throwing-zipexception/2010/6 "2012-08-20T23:36:00Z")

</div>

Not sure how these additional tasks would help. In any case, ‘findbugsMain.getClass()’ is the wrong type; try ‘“FindBugs”’. 'exclude ‘\*\*/_.xml’’ looks good; the pattern '"_/.xml"’ you used earlier looks wrong (it’s an Ant-style glob pattern, not a Java regex).
