【问题标题】:Maven, SonarQube & Exclusions not working as expectedMaven、SonarQube 和排除未按预期工作
【发布时间】:2015-09-29 22:34:23
【问题描述】:

参考https://stackoverflow.com/a/18585688/3639934 我在我的 POM 中添加了以下内容以排除生成的源文件,这些文件存在于target/generated-sources/x/y/z 中。

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

在我的日志文件中,我没有看到任何文件被排除在外,但是在我的项目目录中 target/generated-sources/x/y/z 下有文件。

[10:14:39.346] Source paths: pom.xml, src/main/java
[10:14:39.346] Test paths: src/test/java
[10:14:39.347] Binary dirs: target/classes
[10:14:39.348] Source encoding: UTF-8, default locale: de_DE
[10:14:39.348] Index files
[10:14:39.363] Excluded sources: 
[10:14:39.363]   file:**/generated-sources/**
[10:14:39.484] 47 files indexed
[10:14:39.487] 0 files ignored because of inclusion/exclusion patterns

我正在使用 SQ 5.1.1、Maven 3.2.3、Java 8。

谁能赐教?

【问题讨论】:

  • 这不是我的工作领域,但我的 2 美分将是您排除文件,因此可能缺少尾随 /*
  • 根据this comment,最后应该不需要/*,但我也会试试这个。
  • 不幸的是,它也不适用于file:**/generated-sources/**/*
  • 以前没有人这样做过吗?

标签: sonarqube


【解决方案1】:

好吧,日志骗了我。生成的源从一开始就不是分析的一部分,因此它没有显示任何排除的文件。 当我更改排除模式以匹配来自“src/main/java”的文件时,它会记录预期的排除(并且不分析文件。)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-07-17
    • 2011-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多