50

Using the Gradle FindBugs Plugin, how can I generate the output in HTML format??

The FindBugsExtension do have some config to set.

findbugs {
    toolVersion = "2.0.1"
    sourceSets = [sourceSets.main]
    ignoreFailures = true
    reportsDir = file("$project.buildDir/findbugsReports")
    effort = "max"
    reportLevel = "high"
    visitors = ["FindSqlInjection", "SwitchFallthrough"]
    omitVisitors = ["FindNonShortCircuit"]
    includeFilter = file("$rootProject.projectDir/config/findbugs/includeFilter.xml")
    excludeFilter = file("$rootProject.projectDir/config/findbugs/excludeFilter.xml")
}

But there is no output Properties to set as the findbugs anttask.

1
  • Where did you write this plugin? Is it in the project's build.gradle or module's build.gradle Commented May 4, 2015 at 11:42

1 Answer 1

91

Reports can only be configured on the FindBugs tasks. For example:

tasks.withType(FindBugs) {
    reports {
        xml.enabled = false
        html.enabled = true
    }
}

The same holds for the other code quality plugins (Checkstyle, PMD, etc.).

6
  • 1
    Thank you for the prompt response! Where can I find reference for this task? Is it stated somewhere in the official manual/reference? Also, is it possible to set a style file for generating the html?
    – Lai
    Commented Mar 15, 2013 at 3:28
  • 3
    All tasks are documented in the Gradle Build Language Reference. Sometimes you'll have to follow the links to the Javadoc/Groovydoc. It isn't possible to set a style file. Commented Mar 15, 2013 at 9:00
  • I dont have any such section for "PMD" and I see both reports (.xml and .html). Can you please clarify.
    – AKS
    Commented Sep 12, 2013 at 19:03
  • What do you mean by "I don't have such a section"? All you need to do is tasks.withType(Pmd) { reports { ... } }. Commented Sep 12, 2013 at 20:00
  • @PeterNiederwieser: Please have a look at stackoverflow.com/questions/29967309/…? Commented May 4, 2015 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.