Guia para migração do SpotBugs 3.1 para 4.0

Para usuários do SpotBugs

  • Atualmente, o SpotBugs usa SLF4J em vez de chamar o STDERR/STDOUT diretamente. Portanto, é recomendado que se tenha o SLF4J vinculado ao classpath para executar o SpotBugs.

  • Os arquivos SQL contidos no projeto SpotBugs foram removidos. Geralmente, isso não afeta seu uso.

  • O suporte para JNLP (Applet) foi descontinuado.

Para desenvolvedores de plugins

  • O atributo speed do elemento Detector em findbugs.xml foi descontinuado.

  • A dependência do jaxen foi alterada para o escopo runtime. De modo geral, isso não afeta o seu projeto porque SpotBugs não depende dele diretamente.

  • A dependência de Saxon-HE foi adicionada como uma dependência de escopo runtime.

  • Algumas APIs obsoletas foram removidas. Antes de migrar para o SpotBugs 4.0, consulte o javadoc e migre para a API recomendada.

Guia para migração do FindBugs 3.0 para o SpotBugs 3.1

com.google.code.findbugs:findbugs

Basta substituir com.google.code.findbugs: findbugs por com.github.spotbugs: spotbugs.

<!-- for Maven -->
<dependency>
  <groupId>com.github.spotbugs</groupId>
  <artifactId>spotbugs</artifactId>
  <version>4.8.4</version>
</dependency>
// for Gradle
compile 'com.github.spotbugs:spotbugs:4.8.4'

com.google.code.findbugs:jsr305

JSR305 já está com status inativo. Dessa forma, o SpotBugs não liberará o arquivo jar jsr305.Por favor, continue usando o referente ao findbugs.

com.google.code.findbugs:findbugs-annotations

Em vez disso, use spotbugs-annotations.

<!-- for Maven -->
<dependency>
  <groupId>com.github.spotbugs</groupId>
  <artifactId>spotbugs-annotations</artifactId>
  <version>4.8.4</version>
  <optional>true</optional>
</dependency>
// for Gradle
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.8.4'

com.google.code.findbugs:annotations

Em vez disso, use de spotbugs-annotations e com.github.stephenc.jcip:jcip-annotations: 1.0-1.

<!-- for Maven -->
<dependency>
  <groupId>com.github.stephenc.jcip</groupId>
  <artifactId>jcip-annotations</artifactId>
  <version>1.0-1</version>
  <optional>true</optional>
</dependency>
<dependency>
  <groupId>com.github.spotbugs</groupId>
  <artifactId>spotbugs-annotations</artifactId>
  <version>4.8.4</version>
  <optional>true</optional>
</dependency>
// for Gradle
compileOnly 'com.github.stephenc.jcip:jcip-annotations:1.0-1'
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.8.4'

FindBugs Ant task

Substitua findbugs-ant.jar por spotbugs-ant.jar.

<taskdef
  resource="edu/umd/cs/findbugs/anttask/tasks.properties"
  classpath="path/to/spotbugs-ant.jar" />
<property name="spotbugs.home" value="/path/to/spotbugs/home" />

<target name="spotbugs" depends="jar">
  <spotbugs home="${spotbugs.home}"
            output="xml"
            outputFile="bcel-fb.xml" >
    <auxClasspath path="${basedir}/lib/Regex.jar" />
    <sourcePath path="${basedir}/src/java" />
    <class location="${basedir}/bin/bcel.jar" />
  </spotbugs>
</target>

FindBugs Maven plugin

Por favor, use com.github.spotbugs: spotbugs-maven-plugin em vez de org.codehaus.mojo: findbugs-maven-plugin.

<plugin>
  <groupId>com.github.spotbugs</groupId>
  <artifactId>spotbugs-maven-plugin</artifactId>
  <version>4.8.4.0</version>
  <dependencies>
    <!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
    <dependency>
      <groupId>com.github.spotbugs</groupId>
      <artifactId>spotbugs</artifactId>
      <version>4.8.4</version>
    </dependency>
  </dependencies>
</plugin>

FindBugs Gradle plugin

Por favor, use o plugin Spotbugs disponível em https://plugins.gradle.org/plugin/com.github.spotbugs

plugins {
  id  'com.github.spotbugs' version '6.0.10'
}
spotbugs {
  toolVersion = '4.8.4'
}

// To generate an HTML report and XML report
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
  reports {
    xml.required.set(true)
    html.required.set(true)
  }
}

FindBugs Eclipse plugin

Por favor, use o seguinte site de atualização.