SpotBugs 3.1から4.0への移行ガイド

SpotBugsユーザ向け

  • SpotBugsは標準入出力を直接使うのではなく、SLF4Jを使うようになりました。よってSpotBugs実行時はSLF4Jバインディングがひとつクラスパスに含まれている必要があります。

  • SpotBugsプロジェクトに含まれていたSQLファイルは削除されました。これは基本的な用途には影響しません。

  • JNLP (Applet)のサポートは廃止されました。

プラグイン開発者向け

  • findbugs.xml に含まれる Detector 要素の speed 属性は非推奨になりました。

  • jaxen への依存が runtime スコープに変更されました。SpotBugsはこれに直接依存してはいないため、プラグインプロジェクトには影響しません。

  • Saxon-HE への依存が runtime スコープで追加されました。

  • いくつかの非推奨だったAPIが削除されました。4.0へ移行する前に、Javadocを参考に推奨されたAPIに移行してください。

FindBugs 3.0からSpotBugs 3.1 への移行ガイド

com.google.code.findbugs:findbugs

com.google.code.findbugs:findbugscom.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は、すでに休止状態なので、SpotBugsは jsr305 jarファイルをリリースしません。FindBugs のものを使い続けてください。

com.google.code.findbugs:findbugs-annotations

代わりに 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

代わりに spotbugs-annotationscom.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 タスク

findbugs-ant.jarspotbugs-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 プラグイン

org.codehaus.mojo:findbugs-maven-plugin の代わりに com.github.spotbugs:spotbugs-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 プラグイン

https://plugins.gradle.org/plugin/com.github.spotbugsにある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 プラグイン

代わりに次の更新サイトをご利用ください。