Guide for migration from SpotBugs 3.1 to 4.0

for SpotBugs Users

  • SpotBugs now use SLF4J instead of calling STDERR/STDOUT directly. So when you run SpotBugs, it is recommended to have a SLF4J binding in classpath.
  • SQL files in SpotBugs project are dropped. Generally it does not affect your usage.
  • JNLP (Applet) support is dropped.

for Plugin Developers

  • The speed attribute of Detector element in findbugs.xml is deprecated.
  • The dependency on jaxen has been changed to runtime scope. Generally it does not affect your project because SpotBugs does not depend on it directly.
  • The dependency on Saxon-HE has added as a runtime scope dependency.
  • Some deprecated APIs have been removed, refer the javadoc and migrate to preferred API before you migrate to SpotBugs 4.0.

Guide for migration from FindBugs 3.0 to SpotBugs 3.1

com.google.code.findbugs:findbugs

Simply replace com.google.code.findbugs:findbugs with com.github.spotbugs:spotbugs.

  1. <!-- for Maven -->
  2. <dependency>
  3. <groupId>com.github.spotbugs</groupId>
  4. <artifactId>spotbugs</artifactId>
  5. <version>4.8.5</version>
  6. </dependency>
  1. // for Gradle
  2. compile 'com.github.spotbugs:spotbugs:4.8.5'

com.google.code.findbugs:jsr305

JSR305 is already Dormant status, so SpotBugs does not release jsr305 jar file. Please continue using findbugs’ one.

com.google.code.findbugs:findbugs-annotations

Please depend on spotbugs-annotations instead.

  1. <!-- for Maven -->
  2. <dependency>
  3. <groupId>com.github.spotbugs</groupId>
  4. <artifactId>spotbugs-annotations</artifactId>
  5. <version>4.8.5</version>
  6. <optional>true</optional>
  7. </dependency>
  1. // for Gradle
  2. compileOnly 'com.github.spotbugs:spotbugs-annotations:4.8.5'

com.google.code.findbugs:annotations

Please depend on both of spotbugs-annotations and com.github.stephenc.jcip:jcip-annotations:1.0-1 instead.

  1. <!-- for Maven -->
  2. <dependency>
  3. <groupId>com.github.stephenc.jcip</groupId>
  4. <artifactId>jcip-annotations</artifactId>
  5. <version>1.0-1</version>
  6. <optional>true</optional>
  7. </dependency>
  8. <dependency>
  9. <groupId>com.github.spotbugs</groupId>
  10. <artifactId>spotbugs-annotations</artifactId>
  11. <version>4.8.5</version>
  12. <optional>true</optional>
  13. </dependency>
  1. // for Gradle
  2. compileOnly 'com.github.stephenc.jcip:jcip-annotations:1.0-1'
  3. compileOnly 'com.github.spotbugs:spotbugs-annotations:4.8.5'

FindBugs Ant task

Please replace findbugs-ant.jar with spotbugs-ant.jar.

  1. <taskdef
  2. resource="edu/umd/cs/findbugs/anttask/tasks.properties"
  3. classpath="path/to/spotbugs-ant.jar" />
  4. <property name="spotbugs.home" value="/path/to/spotbugs/home" />
  5. <target name="spotbugs" depends="jar">
  6. <spotbugs home="${spotbugs.home}"
  7. output="xml"
  8. outputFile="bcel-fb.xml" >
  9. <auxClasspath path="${basedir}/lib/Regex.jar" />
  10. <sourcePath path="${basedir}/src/java" />
  11. <class location="${basedir}/bin/bcel.jar" />
  12. </spotbugs>
  13. </target>

FindBugs Maven plugin

Please use com.github.spotbugs:spotbugs-maven-plugin instead of org.codehaus.mojo:findbugs-maven-plugin.

  1. <plugin>
  2. <groupId>com.github.spotbugs</groupId>
  3. <artifactId>spotbugs-maven-plugin</artifactId>
  4. <version>4.8.5.0</version>
  5. <dependencies>
  6. <!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
  7. <dependency>
  8. <groupId>com.github.spotbugs</groupId>
  9. <artifactId>spotbugs</artifactId>
  10. <version>4.8.5</version>
  11. </dependency>
  12. </dependencies>
  13. </plugin>

FindBugs Gradle plugin

Please use spotbugs plugin found on https://plugins.gradle.org/plugin/com.github.spotbugs

  1. plugins {
  2. id 'com.github.spotbugs' version '6.0.14'
  3. }
  4. spotbugs {
  5. toolVersion = '4.8.5'
  6. }
  7. // To generate an HTML report and XML report
  8. tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
  9. reports {
  10. xml.required.set(true)
  11. html.required.set(true)
  12. }
  13. }

FindBugs Eclipse plugin

Please use following update site instead.