Findbugs text report doesn't work

Im looking for a way to add a custom report to FindBugs (and other quality plugins). Basically what I would like is to provide a console output for FindBugs (just like Checkstyle) and was thinking that an StdOutReport would be the best way of doing it. However right now I’m having a little hard time finding the way to extend the capability of FindBugs plugin to provide a custom report type (or override a current one).

My workaround would be parsing a report file in a finalizer task and printing that output out if there are any issues. In addition I’ve encountered that Text-based report is for some reason failing by saying that it’s an unknown property “-text” passed to findbugs. According to changelog since 1.9 all I had to do is specify

reports {
    xml.enabled = false
    text.enabled = true
}

but this does not work.

Any ideas on a better way of doing things? Thanks!

2 Likes

I’d generated the XML and then add a task that uses XSLT to transform the information into another format. For the XSL transformation you could use the Ant task.

Thanks, this is somewhat what I figured as well. Is there a known reason or even a workaround to why text-format is not working even though it was supposed to be supported since 1.9?

Alexej, can you please define “not work”?

What are expecting and what are you getting?

Luke, “dont work” means i’m getting an error when trying to do a report of format “text”. It basically states that “text” is not supported

What is the error?

12:42:04.256 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.api.GradleException: FindBugs encountered an error. Run with --debug to get more information.
12:42:04.257 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.plugins.quality.FindBugs.evaluateResult(FindBugs.groovy:211)
12:42:04.257 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.plugins.quality.FindBugs.run(FindBugs.groovy:180)
12:42:04.257 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
12:42:04.257 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
12:42:04.257 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
12:42:04.257 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
12:42:04.257 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
12:42:04.257 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
12:42:04.258 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
12:42:04.258 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
12:42:04.258 [ERROR] [org.gradle.BuildExceptionReporter]
... 52 more
12:42:04.258 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.IllegalArgumentException: Unknown option: -text
12:42:04.258 [ERROR] [org.gradle.BuildExceptionReporter]
at edu.umd.cs.findbugs.config.CommandLine.parse(CommandLine.java:321)
12:42:04.258 [ERROR] [org.gradle.BuildExceptionReporter]
at edu.umd.cs.findbugs.config.CommandLine.expandOptionFiles(CommandLine.java:177)
12:42:04.258 [ERROR] [org.gradle.BuildExceptionReporter]
at edu.umd.cs.findbugs.FindBugs.processCommandLine(FindBugs.java:333)
12:42:04.258 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.plugins.quality.internal.findbugs.FindBugsExecuter.runFindbugs(FindBugsExecuter.java:43)
12:42:04.258 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.plugins.quality.internal.findbugs.FindBugsWorkerServer.execute(FindBugsWorkerServer.java:44)
12:42:04.258 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.plugins.quality.internal.findbugs.FindBugsWorkerServer.execute(FindBugsWorkerServer.java:35)
12:42:04.258 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.plugins.quality.internal.findbugs.FindBugsWorkerServer.execute(FindBugsWorkerServer.java:26)
12:42:04.258 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.process.internal.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:78)
12:42:04.258 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.process.internal.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:35)
12:42:04.259 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.process.internal.child.ImplementationClassLoaderWorker.execute(ImplementationClassLoaderWorker.java:85)
12:42:04.259 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.process.internal.child.ImplementationClassLoaderWorker.execute(ImplementationClassLoaderWorker.java:41)
12:42:04.259 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.process.internal.child.IsolatedApplicationClassLoaderWorker.call(IsolatedApplicationClassLoaderWorker.java:48)
12:42:04.259 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.process.internal.child.IsolatedApplicationClassLoaderWorker.call(IsolatedApplicationClassLoaderWorker.java:30)
12:42:04.259 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.process.internal.launcher.GradleWorkerMain.run(GradleWorkerMain.java:32)
12:42:04.259 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.process.internal.launcher.GradleWorkerMain.main(GradleWorkerMain.java:37)

Sorry, pasting was hard to read… Basically: ‘java.lang.IllegalArgumentException: Unknown option: -text’

This is a bug in Gradle. I’ve raised GRADLE-2994.

There’s no workaround unfortunately.

1 Like