Skip to content

Latest commit

 

History

History
79 lines (61 loc) · 1.73 KB

File metadata and controls

79 lines (61 loc) · 1.73 KB

spotbugs gradle multi-project build Build Status

Example of usage spotbugs-gradle-plugin (findbugs replacement) with HTML reports enabled in multi module Gradle project

config:

build.gradle file:

buildscript {
  ext {
    spotbugsVersion = '1.6.8'
    toolVersion = '3.1.10'
  }
}

plugins { 
  id 'com.github.spotbugs' version '1.6.8' apply false
}

apply from: "$rootProject.projectDir/gradle/spotbugs.gradle"

defaultTasks 'clean', 'check'

gradle/spotbugs.gradle file:

buildscript {
  repositories {
    maven { url "https://plugins.gradle.org/m2/" }
  }
  dependencies {
    classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:$spotbugsVersion"
  }
}

subprojects {
  apply plugin: "com.github.spotbugs"

  repositories {
    maven { url "https://plugins.gradle.org/m2/" }
  }

  spotbugs {
    toolVersion = project.toolVersion
    effort = "max"
    ignoreFailures = project.findProperty('ignoreBugs') != null
  }

  tasks.withType(com.github.spotbugs.SpotBugsTask) {
    reports {
      html {
        enabled = true
      }
      xml {
        enabled = false
      }
    }
  }
}

versions:

  • gradle: 5.1
  • spotbugs-gradle-plugin: 1.6.8
  • tool: 3.1.10

usage:

./gradlew               # to be failed
./gradlew -PignoreBugs  # do not failed on found bugs

links: