【问题标题】:SonarQube 5.1.1, where to define the file exclusion patterns?SonarQube 5.1.1,在哪里定义文件排除模式?
【发布时间】:2015-09-15 12:48:38
【问题描述】:

我们想从 SonarQube 分析中排除一些文件,但我真的不知道我错过了什么。详情如下:

  • SonarQube 5.1.1
  • mvn sonar:用于分析的声纳
  • 现在可以在 ui 中看到要排除的文件,路径如下:“src/main/webapp/resources/css/custom-theme/jquery-ui-1.8.23.custom.css”

我尝试通过 SonarQube UI 排除文件: -> 项目仪表板 -> 设置 -> 常规设置 -> 排除 -> 文件 -> 源文件排除

使用的排除模式: - src/main/webapp/resources/css/custom-theme/jquery-ui-1.8.23.custom.css - /src/main/webapp/resources/css/custom-theme/jquery-ui-1.8.23.custom.css - 我们还尝试了 **/resources/css/custom-theme/.css 和其他东西

但仍然会分析文件。分析的输出表明,排除模式被用于某些模块,但被其他模块忽略:

不排除:

[INFO] [08:05:22.015] -------------  Scan LMSTEST-UI-APPLICATION
[INFO] [08:05:22.015] Load module settings
[INFO] [08:05:22.037] Initializer FindbugsMavenInitializer
[INFO] [08:05:22.037] Initializer FindbugsMavenInitializer (done) | time=0ms
[INFO] [08:05:22.037] Base dir: /opt/ccde/jenkins_home/jobs/Build_LMSTEST_trunk/workspace/lmstest-ui/tstdatagenui-application
[INFO] [08:05:22.037] Working dir: /opt/ccde/jenkins_home/jobs/Build_LMSTEST_trunk/workspace/lmstest-ui/tstdatagenui-application/target/sonar
[INFO] [08:05:22.037] Source paths: src/main/webapp, pom.xml, src/main/java
[INFO] [08:05:22.037] Binary dirs: target/classes
[INFO] [08:05:22.037] Source encoding: windows-1252, default locale: de_DE
[INFO] [08:05:22.037] Index files
[INFO] [08:05:22.037] Excluded sources: 
[INFO] [08:05:22.037]   src/main/resources/**/*
[INFO] [08:05:22.050] 47 files indexed
[INFO] [08:05:22.050] 0 files ignored because of inclusion/exclusion patterns

排除:

[INFO] [08:05:21.679] -------------  Scan LMSTEST-BACKEND-EAR
[INFO] [08:05:21.679] Load module settings
[INFO] [08:05:21.700] Initializer FindbugsMavenInitializer
[INFO] [08:05:21.700] Initializer FindbugsMavenInitializer (done) | time=0ms
[INFO] [08:05:21.700] Base dir: /opt/ccde/jenkins_home/jobs/Build_LMSTEST_trunk/workspace/lmstest-backend/lmstest-backend-ear
[INFO] [08:05:21.700] Working dir: /opt/ccde/jenkins_home/jobs/Build_LMSTEST_trunk/workspace/lmstest-backend/lmstest-backend-ear/target/sonar
[INFO] [08:05:21.700] Source paths: pom.xml
[INFO] [08:05:21.700] Source encoding: UTF-8, default locale: de_DE
[INFO] [08:05:21.701] Index files
[INFO] [08:05:21.701] Excluded sources: 
[INFO] [08:05:21.701]   src/main/webapp/resources/css/custom-theme/jquery-ui-1.8.23.custom.css
[INFO] [08:05:21.701]   **/src/main/webapp/resources/css/custom-theme/jquery-ui-1.8.23.custom.css
[INFO] [08:05:21.701]   LMSTEST-UI-APPLICATION/src/main/webapp/resources/css/custom-theme/jquery-ui-1.8.23.custom.csssrc/main/webapp/resources/css/custom-theme/jquery-ui-1.8.23.custom.css
[INFO] [08:05:21.701]   **/LMSTEST-UI-APPLICATION/src/main/webapp/resources/css/custom-theme/jquery-ui-1.8.23.custom.csssrc/main/webapp/resources/css/custom-theme/jquery-ui-1.8.23.custom.css
[INFO] [08:05:21.702] 1 files indexed
[INFO] [08:05:21.702] 0 files ignored because of inclusion/exclusion patterns

总结一下我的问题: 有谁知道为什么在一个模块的相同分析中使用排除模式而不是另一个模块。我们没有配置任何特殊的东西,它只是 mvn sonar:sonar。 配置是在项目级别完成的,而不是在组件级别。

提前感谢您的想法。

【问题讨论】:

    标签: sonarqube


    【解决方案1】:

    您似乎以某种方式覆盖了模块级别的排除设置。见

    [INFO] [08:05:22.037] Excluded sources: 
    [INFO] [08:05:22.037]   src/main/resources/**/*
    

    在 UI 中项目级别定义的设置被模块级别定义的设置覆盖,然后是项目本地属性(即 pom.xml 中定义的属性),然后是命令行。

    【讨论】:

    • 这确实是这里的问题。谢谢。
    猜你喜欢
    • 2021-09-03
    • 2018-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-14
    • 1970-01-01
    • 2015-11-27
    • 2016-08-01
    相关资源
    最近更新 更多