Skip to content

Instantly share code, notes, and snippets.

@ignaciotcrespo
Last active October 28, 2020 16:46
Show Gist options
  • Save ignaciotcrespo/bc685062add343f8eca6b81d10447ca7 to your computer and use it in GitHub Desktop.
Save ignaciotcrespo/bc685062add343f8eca6b81d10447ca7 to your computer and use it in GitHub Desktop.
Spotbugs in android + gradle plugin 4.1.4 + gradle wrapper 6.5
// works with
// gradle plugin: 4.1.0
// gradle wrapper: 6.5
// How to use: ./gradlew clean spotbugsYourFlavor
// ------ app/build.gradle -----------
apply plugin: 'com.github.spotbugs'
dependencies {
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.7.1'
}
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) { task ->
def flavor = task.name.replaceAll("spotbugs(.)", "\$1")
flavor = flavor[0].toLowerCase() + flavor.substring(1)
classes = files("${project.buildDir}/intermediates/javac/$flavor/classes")
ignoreFailures = true
showStackTraces = false
reports {
html.enabled = false
xml.enabled = true
}
}
// works with
// gradle plugin: 4.1.0
// gradle wrapper: 6.5
// ----- root build.gradle -------
buildscript {
repositories {
jcenter()
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.5.1"
}
}
plugins {
id 'com.github.spotbugs' version '4.5.1'
}
allprojects {
repositories {
jcenter()
google()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment