迁移指南
登录后可跨设备保存划线和私人笔记登录
从 SpotBugs 3.1 迁移到 4.0 的迁移指南
面向 SpotBugs 用户
- SpotBugs 现在使用 SLF4J,而不是直接调用 STDERR/STDOUT。因此,运行 SpotBugs 时,建议在 classpath 中包含 SLF4J 绑定。
- SpotBugs 项目中的 SQL 文件已移除。通常这不会影响您的使用。
- 已移除 JNLP(Applet)支持。
面向插件开发者
findbugs.xml中Detector元素的speed属性已弃用。- 对
jaxen的依赖已更改为runtime作用域。通常这不会影响您的项目,因为 SpotBugs 不直接依赖它。 - 对
Saxon-HE的依赖已作为runtime作用域依赖项添加。 - 部分已弃用的 API 已被移除,请参考 javadoc 并在迁移到 SpotBugs 4.0 之前迁移到推荐的 API。
从 FindBugs 3.0 迁移到 SpotBugs 3.1 的迁移指南
com.google.code.findbugs:findbugs
只需将 com.google.code.findbugs:findbugs 替换为 com.github.spotbugs:spotbugs。
<!-- for Maven -->
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs</artifactId>
<version>4.8.5</version>
</dependency>// for Gradle
compile 'com.github.spotbugs:spotbugs:4.8.5'com.google.code.findbugs:jsr305
JSR305 已处于 Dormant(休眠)状态,因此 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.5</version>
<optional>true</optional>
</dependency>// for Gradle
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.8.5'com.google.code.findbugs:annotations
请改为同时依赖 spotbugs-annotations 和 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.5</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.5'FindBugs Ant 任务
请将 findbugs-ant.jar 替换为 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 插件
请使用 com.github.spotbugs:spotbugs-maven-plugin 代替 org.codehaus.mojo:findbugs-maven-plugin。
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.8.5.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.5</version>
</dependency>
</dependencies>
</plugin>FindBugs Gradle 插件
请使用 https://plugins.gradle.org/plugin/com.github.spotbugs 上提供的 spotbugs 插件
plugins {
id 'com.github.spotbugs' version '6.0.14'
}
spotbugs {
toolVersion = '4.8.5'
}
// 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 插件
请改用以下更新站点。
评论
登录后参与评论
正在加载评论…
KnowForge