spotbugs追加插件以及配置

SpotBugs 插件
SpotBugs 还有对应的额外插件,用于扩展对应的规则,探测出更多的代码问题。

1.findsecbugs-plugin 追加130条规则

			<plugin>
				<groupId>com.github.spotbugs</groupId>
				<artifactId>spotbugs-maven-plugin</artifactId>
				<version>${spotbugs.version}</version>
				<configuration>
					<plugins>
						<plugin>
							<groupId>com.h3xstream.findsecbugs</groupId>
							<artifactId>findsecbugs-plugin</artifactId>
							<version>1.11.0</version>
						</plugin>

						<plugin>
							<groupId>com.mebigfatguy.sb-contrib</groupId>
							<artifactId>sb-contrib</artifactId>
							<version>7.4.7</version>
						</plugin>
					</plugins>
				</configuration>
			</plugin>

2.sb-contrib

GitHub - mebigfatguy/fb-contrib: a FindBugs/SpotBugs plugin for doing static code analysis for java code bases

最新7.4.7 增加了大致130+条规则

			<!-- https://spotbugs.github.io/ -->
			<!-- https://spotbugs.github.io/spotbugs-maven-plugin/usage.html -->
			<plugin>
				<groupId>com.github.spotbugs</groupId>
				<artifactId>spotbugs-maven-plugin</artifactId>
				<version>${spotbugs.version}</version>
				<configuration>
					<plugins>
						<plugin>
							<groupId>com.mebigfatguy.sb-contrib</groupId>
							<artifactId>sb-contrib</artifactId>
							<version>7.4.7</version>
						</plugin>
					</plugins>
				</configuration>
			</plugin>

3.spotbugs配置

<plugin>
				<groupId>com.github.spotbugs</groupId>
				<artifactId>spotbugs-maven-plugin</artifactId>
				<version>${spotbugs.version}</version>
				<configuration>
          		<xmlOutput>true</xmlOutput>
          		<xmlOutputDirectory>target/site</xmlOutputDirectory>
          		 <!-- <excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
                 <includeFilterFile>spotbugs-include.xml</includeFilterFile>-->
				</configuration>
</plugin>

SpotBugs Maven Plugin – Usage

SpotBugs Maven Plugin – spotbugs:check

 


版权声明:本文为m0_37727363原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。