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)
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…
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)
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).