java - 在 Sonar 中排除生成的代码

标签 java maven maven-plugin sonarqube

如何从 Sonar 处理和报告中排除生成的代码?

我试过 exclude **/*generated* 但像 org.blayo.generated 这样的包仍在报告中:

<plugin>
  ...
  <artifactId>maven-checkstyle-plugin</artifactId>
  <configuration>

    <excludes>**/*generated*</excludes>

编辑:正确的正则表达式是**/generated/*.java

最佳答案

排除模式自 SonarQube 3.5 以来发生了变化。现在它是这样工作的:

<properties>
   <sonar.exclusions>file:**/generated-sources/**</sonar.exclusions>
</properties>

来源:SonarQube JIRA

关于java - 在 Sonar 中排除生成的代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13705726/

相关文章:

java interscect, union, join, distinct 列表与谓词

java - 自定义表模型中的 JComboBox

java - @org.testng.annotations.Test 和 @org.junit.Test 问题

java - PackProtocolException : invalid advertisement when using the jgitflow-maven-plugin withing a jenkins job

java - 使用 Maven 连续触发 wsgen & wsimport,使用 wsdlLocation

java - IntelliJ JDK 16 Early Access - 成功了吗?工具.jar

java - 如何在sql表中自动插入日期和时间

java - @Component Scan 无法在 Spring Boot 中跨 jar 和 war 使用 @Component

jar - 当有重复的类时,Maven shade 插件是否会导致构建失败?

maven-2 - 将 BIRT 运行时覆盖到正确的 WAR 位置