【问题标题】:Multi module project analysis with SonarQube使用 SonarQube 进行多模块项目分析
【发布时间】:2015-11-20 12:52:24
【问题描述】:

SonarQube Server 5.1.2, Sonar-Runner 2.4

正如Multi-moduleProject 中提供的那样,我已经创建了一个项目结构

Accounts
|
->invoice
  |
   ->src

->receipt
  |
   ->src

->sonar.properties

文件:sonar.properties

sonar.projectKey=org.mycompany.acc
sonar.projectName=Account
sonar.projectVersion=1.0

sonar.sources=src

sonar.modules=invoice,receipt

invoice.sonar.projectName=Invoice
receipt.sonar.projectName=Receipt

在 sonar-runner 中执行上述配置时,我遇到错误“帐户”目录中缺少“src”文件夹,希望此配置与该链接中可用的 conf 相同。据了解,如果配置没问题,那么Invoice和Receipt会在Account Project下列为sub project,那么以上配置需要做哪些改动才能实现一个project下的多模块/project .

错误

ERROR: Error during Sonar runner execution ERROR: Unable to execute Sonar ERROR: Caused by: The folder 'src' does not exist for 'org.mycompany.acc' (base directory = C:\Users\xyz\Accounts\.) ERROR: ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with t he -e switch. ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.

【问题讨论】:

  • 是“错误”还是警告?
  • 所以你需要指定模块的基目录。
  • @BheshGurung,你甚至尝试过sonar.projectBaseDir=C:/Users/xyz/Accounts,但仍然遇到同样的错误。只有当我在C:/Users/xyz/Accounts 路径中有src 文件夹时它才能解决,但它应该从模块文件夹中引用 src 对吗?
  • 您的 SonarQube 和 SonarQube Runner 版本是什么?
  • @JulienH.-SonarSourceTeam SonarQube 服务器 5.1.2,Sonar-Runner 2.4

标签: sonarqube sonar-runner sonarqube5.1


【解决方案1】:

试试这个:

sonar.projectKey=org.mycompany.acc
sonar.projectName=Account
sonar.projectVersion=1.0

sonar.sources=src # try to remove this by the way if you don't have suchdirectory under root folder of project

sonar.modules=invoice,receipt

invoice.sonar.projectName=Invoice
invoice.sonar.sources=invoice/src
receipt.sonar.projectName=Receipt
receipt.sonar.sources=receipt/src

【讨论】:

  • 适用于 sonarqube 版本 6,SonarQube Scanner 2.8
  • 在声纳 6.2 中对我不起作用docs.sonarqube.org/display/SCAN/…
  • 根据上面的文档链接,您可以通过在每个模块目录中放置一个嵌套的 sonar.properties 文件来实现类似的事情,并仅覆盖相关设置。
  • sonarqube 扫描仪 3.3 适合我们的工作
【解决方案2】:

你可以试试这个选项,如果你想同时扫描多个项目或者在同一个版本中,那么试试这个选项。

sonar.sources=发票,收据

【讨论】:

    猜你喜欢
    • 2015-01-19
    • 2015-12-23
    • 1970-01-01
    • 2021-02-09
    • 2017-01-10
    • 2019-12-07
    • 2015-05-19
    • 2018-09-10
    • 2016-06-16
    相关资源
    最近更新 更多