How to generate HTML output using Gradle FindBugs Plugin

Lai picture Lai · Mar 14, 2013 · Viewed 17.5k times · Source

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.

Answer

Peter Niederwieser picture Peter Niederwieser · Mar 14, 2013

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