Skip to content

Commit

Permalink
replace FindBugs with newer SpotBugs
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Schmid <service@aaschmid.de>
  • Loading branch information
aaschmid committed Jul 7, 2018
1 parent b7c1f26 commit b277f01
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -3,8 +3,8 @@ dist: trusty
sudo: false

script:
- ./gradlew build -Pjunit4Version=4.10 -PjunitJupiterVersion=5.0.3 -PskipFindBugs
- ./gradlew build -Pjunit4Version=4.11 -PjunitJupiterVersion=5.1.1 -PskipFindBugs
- ./gradlew build -Pjunit4Version=4.10 -PjunitJupiterVersion=5.0.3 -PskipSpotBugs
- ./gradlew build -Pjunit4Version=4.11 -PjunitJupiterVersion=5.1.1 -PskipSpotBugs

- ./gradlew build

Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Expand Up @@ -81,7 +81,7 @@ pipeline {
post {
always {
dry canComputeNew: false, defaultEncoding: '', healthy: '', pattern: 'build/reports/cpd/*.xml', unHealthy: ''
findbugs defaultEncoding: '', excludePattern: '**/*Test.java', healthy: '', includePattern: '', pattern: '**/build/reports/findbugs/*.xml', unHealthy: '', unstableNewAll: '0'
findbugs defaultEncoding: '', excludePattern: '**/*Test.java', healthy: '', includePattern: '', pattern: '**/build/reports/spotbugs/*.xml', unHealthy: '', unstableNewAll: '0'
jacoco classPattern: '**/build/classes/*/main/', execPattern: '**/build/jacoco/*.exec', sourcePattern: '**/src/main/java'
warnings canComputeNew: false, canResolveRelativePaths: false, categoriesPattern: '', consoleParsers: [[parserName: 'Java Compiler (Eclipse)'], [parserName: 'Java Compiler (javac)'], [parserName: 'JavaDoc Tool']], defaultEncoding: 'UTF-8', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', unHealthy: ''
}
Expand Down
33 changes: 20 additions & 13 deletions build.gradle
@@ -1,3 +1,14 @@
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.2"
}
}

plugins {
id 'com.github.kt3k.coveralls' version '2.3.1'
id 'de.aaschmid.cpd' version '1.1'
Expand All @@ -6,8 +17,8 @@ plugins {
ext {
isBuildOnJenkins = System.env['BUILD_TAG']?.startsWith('jenkins-') ?: false
}
ext.skipFindBugs = hasProperty('skipFindBugs')
println "Using skipFindBugs = ${skipFindBugs} for current build."
ext.skipSpotBugs = hasProperty('skipSpotBugs')
println "Using skipSpotBugs = ${skipSpotBugs} for current build."

if (!hasProperty('junit4Version')) { // set default junit version if not set via command line
ext.junit4Version = '4.12'
Expand All @@ -33,7 +44,7 @@ subprojects {
apply plugin: 'eclipse'
apply plugin: 'jacoco'
apply plugin: 'java-library'
apply plugin: 'findbugs'
apply plugin: 'com.github.spotbugs'
apply plugin: 'osgi'

group = 'com.tngtech.junit.dataprovider'
Expand All @@ -47,7 +58,7 @@ subprojects {
}

dependencies {
implementation group: 'com.google.code.findbugs', name: 'annotations', version: '3.0.1'
implementation group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: '3.1.5'
}
}

Expand Down Expand Up @@ -98,7 +109,7 @@ project(':junit4') {
api project(':core')
api group: 'junit', name: 'junit', version: junit4Version

implementation group: 'com.google.code.findbugs', name: 'annotations', version: '3.0.1'
implementation group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: '3.1.5'

testCompile group: 'org.assertj', name: 'assertj-core', version: '1.7.1'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.18.3'
Expand Down Expand Up @@ -278,21 +289,17 @@ subprojects {
toolVersion = '0.8.1'
}

findbugs {
if (System.getProperty("java.version")[0..2] in [ '1.6' ]) { // FindBugs v3.0.0 does not work with Java < v1.7 :-(
toolVersion = '2.0.3'
} else {
toolVersion = '3.0.1'
}
spotbugs {
toolVersion = '3.1.3'
ignoreFailures = true
}

plugins.withType(JavaBasePlugin) {
check.dependsOn(rootProject.cpdCheck)
}

tasks.withType(FindBugs).each { task ->
task.enabled = !rootProject.skipFindBugs
tasks.withType(com.github.spotbugs.SpotBugsTask).each { task ->
task.enabled = !rootProject.skipSpotBugs
}
}

Expand Down
6 changes: 3 additions & 3 deletions junit-jupiter-params/pom.xml
Expand Up @@ -78,9 +78,9 @@
<version>5.1.1</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
<version>2.0.1</version>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>3.1.5</version>
</dependency>

<dependency>
Expand Down
6 changes: 3 additions & 3 deletions junit-jupiter/pom.xml
Expand Up @@ -76,9 +76,9 @@
<version>5.1.1</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
<version>2.0.1</version>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>3.1.5</version>
</dependency>

<dependency>
Expand Down
6 changes: 3 additions & 3 deletions junit4/pom.xml
Expand Up @@ -83,9 +83,9 @@

<dependencies>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
<version>2.0.1</version>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>3.1.5</version>
</dependency>

<dependency>
Expand Down

0 comments on commit b277f01

Please sign in to comment.