我可以使用以下命令排除*.kt文件
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<configuration>
<excludeFilterFile>spotbugs-exclude-filter.xml</excludeFilterFile>
</configuration>
</plugin>在包含以下内容的spotbugs-exclude-filter.xml中:
<FindBugsFilter>
<Match>
<Source name="~.*\.kt"/>
</Match>
</FindBugsFilter> 但是,由于spotbugs位于父pom中(由Java和Kotlin项目使用),我更喜欢纯maven解决方案,因此继承项目不需要额外的xml文件。有可能吗?
发布于 2019-03-19 23:44:14
SpotBugs假设代码是从Java类编译而来的(即使类文件可能具有正确的文件名)。如果您查看SpotBugs XML报告文件,您将看到根据SpotBugs的源文件。为了排除Kotlin类,你必须像下面这样做,因为Kotlin编译成了XxxxxxKt.class
<FindBugsFilter>
<Match>
<Source name="~.*Kt\.java"/>
</Match>
</FindBugsFilter>发布于 2020-10-23 16:07:47
在插件配置中,使用includeFilterFile代替excludeFilterFile。
并将模式从"~.*\.kt"更改为"~.*Kt\.java"。
https://stackoverflow.com/questions/55060459
复制相似问题