Why SpotBugs Gradle plugin always generate XML report instead of HTML?
Asked Answered
S

0

7

I am using Gradle 5.2, spotbugs-gradle-plugin version 2.0.0 and tried to generate SpotBugs report on my project. I used the following configuration on my project but it always create XML reports instead of html report.

buildscript {
    repositories {
        jcenter()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }

    dependencies {
        classpath 'com.github.jengelman.gradle.plugins:shadow:+'
        classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:2.0.0"
    }
}

allprojects {
    apply plugin: 'com.github.johnrengelman.shadow'
    apply plugin: 'java'
    apply plugin: 'eclipse'
    apply plugin: 'com.github.spotbugs'

    group = 'com.myproject'
    version = '1.0.0'

    repositories {
        mavenCentral()
    }

    dependencies {
        compile('com.google.cloud:google-cloud-storage:+') {
            exclude group: "com.google.guava", module: "guava"
        }
        compile group: 'org.apache.commons', name: 'commons-collections4', version: '+'
        compile group: 'com.google.guava', name: 'guava', version: '+'

        testImplementation('org.junit.jupiter:junit-jupiter:+')
    }

    test {
        useJUnitPlatform()
        testLogging {
            events "passed", "skipped", "failed"
        }
    }
}

project(':myproject') {
    dependencies {
        compile group: 'com.github.javafaker', name: 'javafaker', version: '+'
        compile group: 'org.jsonschema2pojo', name: 'jsonschema2pojo-core', version: '+'
        compile group: 'commons-lang', name: 'commons-lang', version: '+'
        compile group: 'org.mongodb', name: 'bson', version: '+'
    }
}

tasks.withType(JavaCompile) {
    options.compilerArgs << '-Xlint:unchecked'
    options.deprecation = true
}

spotbugsMain {
    reports {
        xml.enabled = false
        html.enabled = true
    }
}

What I did wrong here?

Kindly provide your inputs to create HTML report instead of XML!

Sikko answered 22/10, 2019 at 9:22 Comment(3)
You have xml.enabled and html.enabled both set to true, but you can't get simultaneous XML and HTML reports. See Support xml and html reports at once #114 and Allow multiple output types #857. Since setting both values to true makes no sense, try setting xml.enabled = false. Do you get an html report if you do that?Staub
Whatever I set its not generating html reports, always generating xml.Sikko
Instead of spotbugsMain try task spotbugs like here: #51192315 Or this one: github.com/wreulicke/spotbugs-gradle-plugin-issue32-reproduce/…Keelby

© 2022 - 2024 — McMap. All rights reserved.