Html – How to generate HTML output using Gradle FindBugs Plugin

findbugsgradlehtml

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.

Best Answer

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