Using gradle 1.10 and findbugs plugin: failed to run task. Execution failed for task ':findbugsMain'


(Sascha Müller) #1

I tried to use “findbugs” in a new project I’m working on. My build.gradle:

apply plugin: 'java'
apply plugin: 'findbugs'
  version = '1.0'
  repositories {
    mavenCentral()
}
  dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
}

and ran task “findbugsMain” which gave me the following error:

:findbugsMain FAILED
  FAILURE: Build failed with an exception.
  * What went wrong:
Execution failed for task ':findbugsMain'.
> FindBugs encountered an error. Run with --debug to get more information.
  * Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  BUILD FAILED
  Total time: 9.871 secs
20:34:22: External task execution finished 'findbugsMain'.

So I digged a little deeper and ran “findbugsMain --stacktrace”. This is the result:

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':findbug
sMain'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecuteActions(ExecuteActionsTaskExecuter.java:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecute(ExecuteActionsTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExec
uter.execute(PostExecutionAnalysisTaskExecuter.java:35)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.exec
ute(SkipUpToDateTaskExecuter.java:64)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execut
e(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecu
ter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter
.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execut
e(SkipOnlyIfTaskExecuter.java:53)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter
.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailur
e(AbstractTask.java:289)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorW
orker.executeTask(AbstractTaskPlanExecutor.java:79)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorW
orker.processTask(AbstractTaskPlanExecutor.java:63)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorW
orker.run(AbstractTaskPlanExecutor.java:51)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$1.run(DefaultT
askPlanExecutor.java:33)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(Def
aultCacheAccess.java:198)
        at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(Def
aultCacheAccess.java:266)
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunning
Operation(DefaultPersistentDirectoryStore.java:135)
        at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStat
eCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:95)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(Defaul
tTaskPlanExecutor.java:31)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(Defau
ltTaskGraphExecuter.java:86)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTask
ExecutionAction.java:29)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecute
r.java:61)
        at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExec
uter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecu
ter.java:67)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildEx
ecutionAction.java:32)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecute
r.java:61)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecute
r.java:54)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(Default
GradleLauncher.java:166)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradle
Launcher.java:113)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLaun
cher.java:81)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildCon
troller.run(InProcessBuildActionExecuter.java:64)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.jav
a:33)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.jav
a:24)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce
ssBuildActionExecuter.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce
ssBuildActionExecuter.java:26)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
        at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.jav
a:171)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.
execute(CommandLineActionFactory.java:201)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.
execute(CommandLineActionFactory.java:174)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(
CommandLineActionFactory.java:170)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(
CommandLineActionFactory.java:139)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep
ortingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep
ortingAction.java:22)
        at org.gradle.launcher.Main.doAction(Main.java:46)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at org.gradle.launcher.Main.main(Main.java:37)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBoots
trap.java:50)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.j
ava:32)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.ja
va:30)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:58)
Caused by: org.gradle.api.GradleException: FindBugs encountered an error. Run wi
th --debug to get more information.
        at org.gradle.api.plugins.quality.FindBugs.evaluateResult(FindBugs.groov
y:211)
        at org.gradle.api.plugins.quality.FindBugs.run(FindBugs.groovy:180)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskF
actory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskF
actory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskF
actory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(Abstra
ctTask.java:533)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(Abstra
ctTask.java:516)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecuteAction(ExecuteActionsTaskExecuter.java:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecuteActions(ExecuteActionsTaskExecuter.java:61)
        ... 52 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 35328
        at org.objectweb.asm.ClassReader.accept(Unknown Source)
        at edu.umd.cs.findbugs.asm.FBClassReader.accept(FBClassReader.java:44)
        at org.objectweb.asm.ClassReader.accept(Unknown Source)
        at edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassP
arserUsingASM.java:110)
        at edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassP
arserUsingASM.java:554)
        at edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(
ClassInfoAnalysisEngine.java:76)
        at edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(
ClassInfoAnalysisEngine.java:38)
        at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(Ana
lysisCache.java:266)
        at edu.umd.cs.findbugs.ba.npe.TypeQualifierNullnessAnnotationDatabase.ge
tXMethod(TypeQualifierNullnessAnnotationDatabase.java:293)
        at edu.umd.cs.findbugs.ba.npe.TypeQualifierNullnessAnnotationDatabase.ad
dMethodParameterAnnotation(TypeQualifierNullnessAnnotationDatabase.java:355)
        at edu.umd.cs.findbugs.ba.DefaultNullnessAnnotations.addDefaultNullnessA
nnotations(DefaultNullnessAnnotations.java:63)
        at edu.umd.cs.findbugs.ba.npe.TypeQualifierNullnessAnnotationDatabase.lo
adAuxiliaryAnnotations(TypeQualifierNullnessAnnotationDatabase.java:390)
        at edu.umd.cs.findbugs.ba.AnalysisCacheToAnalysisContextAdapter.updateDa
tabases(AnalysisCacheToAnalysisContextAdapter.java:420)
        at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1142)
          at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:279)
        at org.gradle.api.plugins.quality.internal.findbugs.FindBugsExecuter.run
Findbugs(FindBugsExecuter.java:44)
        at org.gradle.api.plugins.quality.internal.findbugs.FindBugsWorkerServer
.execute(FindBugsWorkerServer.java:44)
        at org.gradle.api.plugins.quality.internal.findbugs.FindBugsWorkerServer
.execute(FindBugsWorkerServer.java:35)
        at org.gradle.api.plugins.quality.internal.findbugs.FindBugsWorkerServer
.execute(FindBugsWorkerServer.java:26)
        at org.gradle.process.internal.child.ActionExecutionWorker.execute(Actio
nExecutionWorker.java:78)
        at org.gradle.process.internal.child.ActionExecutionWorker.execute(Actio
nExecutionWorker.java:35)
        at org.gradle.process.internal.child.ImplementationClassLoaderWorker.exe
cute(ImplementationClassLoaderWorker.java:85)
        at org.gradle.process.internal.child.ImplementationClassLoaderWorker.exe
cute(ImplementationClassLoaderWorker.java:41)
        at org.gradle.process.internal.child.IsolatedApplicationClassLoaderWorke
r.call(IsolatedApplicationClassLoaderWorker.java:48)
        at org.gradle.process.internal.child.IsolatedApplicationClassLoaderWorke
r.call(IsolatedApplicationClassLoaderWorker.java:30)
        at org.gradle.process.internal.launcher.GradleWorkerMain.run(GradleWorke
rMain.java:32)
        at org.gradle.process.internal.launcher.GradleWorkerMain.main(GradleWork
erMain.java:37)

This happens with a completely new project as with existing projects. If you need more information let me know.

PS: gradle -v:

------------------------------------------------------------
Gradle 1.10
------------------------------------------------------------
  Build time:
 2013-12-17 09:28:15 UTC
Build number: none
Revision:
   36ced393628875ff15575fa03d16c1349ffe8bb6
  Groovy:
     1.8.6
Ant:
        Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy:
        2.2.0
JVM:
        1.8.0-ea (Oracle Corporation 25.0-b50)
OS:
         Windows 8.1 6.3 amd64

(Luke Daley) #2

This is coming from the internals of FindBugs.

Did this just start happening all of a sudden? Any triggers?


(Sascha Müller) #3

Well, I tried using findbugs with gradle 1.9 before, but quickly got rid of the plugin again due to internal (I believe) asm library incompatibilities or something. I wanted to try with the new version of gradle and took the exact same project as before with gradle 1.9. I also tested on a completely new project with just a short main method but got the same result. So I don’t think there were any triggers that caused this.

If this is a findBugs problem: Is it possible to use another version in some way without compiling the plugin myself?


(Peter Niederwieser) #4

By default, Gradle uses FindBugs 2.0.1, and it looks like that FindBugs version isn’t able to analyze Java 8 class files. You can set a different FindBugs version with ‘findbugs.toolVersion = “2.0.3”’ (for example). Perhaps you should first check if FindBugs supports Java 8 by now.


(Sascha Müller) #5

Ok, seems Java 8 was in fact the problem. Version 2.0.3 of FindBugs gives the same error. The website of Findbugs states that “some classfiles compiled for Java 1.8”. These problems will be addressed in the next major version. So I installed Java 7 and everything works just fine now.

Thanks to both of you for your help.