我想使用qulice-maven-plugin我不想使用默认的 findBugs 规则,而是设置一次自定义规则。那可能吗? - 另外,我不希望 qulice-maven-plugin 在 checkstyle 违规上失败,但我不想禁用该插件。如何更改默认的qulice-maven-plugin、checkstyle配置?
<build>
<plugins>
<plugin>
<groupId>com.qulice</groupId>
<artifactId>qulice-maven-plugin</artifactId>
<version>0.16.4</version>
<configuration>
<license>file:${basedir}/LICENSE.txt</license>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
最佳答案
无法覆盖 qulice 中的规则。其背后的基本思想是它有一套不可更改的规则。因此,每个使用 qulice 的项目看起来都差不多。
您只能使用正则表达式 (checkstyle:.*) 禁用 qulice,如下所示:
<plugin>
<groupId>com.qulice</groupId>
<artifactId>qulice-maven-plugin</artifactId>
<version>0.16.5</version>
<configuration>
<license>file:./LICENSE.txt</license>
<excludes>
<exclude>findbugs:~com.qulice.foo.M.*</exclude>
<exclude>findbugs:com.qulice.foo.Bar</exclude>
<exclude>findbugs:.*</exclude>
<exclude>checkstyle:.*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
所以你只能实现第二个要求 - 如果 checkstyle 失败,构建也不会失败。
对于 findbug,您需要使用 SuppressFBWarnings
(来自 edu.umd.cs.findbugs.annotations
),如下所示:@SuppressFBWarnings("JLM_JSR166_UTILCONCURRENT_MONITORENTER")
关于java - 设置自定义 findBugs 规则,使用 qulice-maven-plugin 禁用failesOnViolation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37436523/