SpotBugs 忽略 src 文件夹中的整个目录

问题描述

嗨,

在我的 maven 设置中,我有一个插件,它生成代码并将其放入我的 java src 文件夹中。
由于此代码自动生成的,我想将其从所有 SpotBugs 检查中排除。

文件结构如下:

-- src
    |
    --- generated    <-- No files in this folder should be checked
    |
    --- main         <-- The "normal" java files,which should be checked

我尝试了一些方法包括以下内容,但没有任何效果

<FindBugsFilter>
  <Match>
    <Source name="~.*generated.*"/>
  </Match>
</FindBugsFilter>

这是我在 pom.xml 中的插件配置:

<plugin>
  <groupId>com.github.spotbugs</groupId>
  <artifactId>spotbugs-maven-plugin</artifactId>
  <version>4.2.0</version>
  <configuration>
    <excludeFilterFile>config/spotbugs-excludes.xml</excludeFilterFile>
    <effort>Max</effort>
    <threshold>normal</threshold>
    <failOnError>true</failOnError>
    <includeTests>false</includeTests>
    <spotbugsXmlOutput>true</spotbugsXmlOutput>
    <xmlOutput>true</xmlOutput>
    <plugins>
      <plugin>
        <groupId>com.h3xstream.findsecbugs</groupId>
        <artifactId>findsecbugs-plugin</artifactId>
        <version>1.11.0</version>
      </plugin>
      <plugin>
        <groupId>com.mebigfatguy.fb-contrib</groupId>
        <artifactId>fb-contrib</artifactId>
        <version>7.4.3.sb</version>
      </plugin>
    </plugins>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>check</goal>
      </goals>
      <phase>generate-test-sources</phase>
    </execution>
  </executions>
</plugin>

问候
克里斯

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...