SonarQube 未能从 Jenkins 项目中获取 git 责备信息
SonarQube fails to get git blame information from Jenkins project
我配置了一个 Jenkins 主项目 P
来管理两个 git 存储库 A
和 B
。此主项目 P
仅更新 git 源并调用来自其工作区的源的声纳分析。
这是我的树文件夹。
{Jenkins Install Path} \ workspace \ P
|-- A
|-- .git/
|-- all projects A files
|-- B
|-- .git/
|-- all projects B files
当 Jenkins 为 P
运行声纳分析时,出现以下错误
SCM provider for this project is: git
2664 files to be analyzed
0/2664 files analyzed
Missing blame information for the following files:
(all files)
该错误是合乎逻辑的,因为 SonarQube 正在寻找 {Jenkins Install Path} \ workspace \ P
下的 .git
文件夹。它不存在。
我在互联网上四处寻找解决方案,但没有找到答案。我正在使用安装在 windows.
上的 SonarQube 5.5
你有什么想法让 SonarQube 与我的配置一起工作吗?
这种情况与 不同,因为根本原因是我通过单个 SonarQube 分析使用了两个 git 文件夹提取。
我访问和阅读了几次的资料
您可以设置由 P
触发的分析作业。
分析作业可以带一个参数,应该分析 P
工作区内的哪个存储库。作业本身应该使用与 P
相同的工作区,并且只调用 SonarQube 分析。
根据@CSchulz 的回答,我找到了使用 SonarQube module
的解决方案
我将 SonarQube 配置为使用对应于我的 A
和 B
git 项目的两个子模块。每个项目都将 git 模块的名称作为重要的 projectBaseDir
参数。
sonar.projectKey=P
sonar.projectName=P
sonar.projectVersion=4.0.0
sonar.binaries=.
sonar.cxx.includeDirectories=Common/Path
sonar.cxx.cppcheck.reportPath=cppCheckReport.xml # Reports are present in A and B forlder
# 2 modules definition
sonar.modules=A,B
# Module A
IHM.sonar.projectBaseDir=A
IHM.sonar.projectName=A
IHM.sonar.sources=.
IHM.sonar.cxx.includeDirectories=XXX
# Module B
Shares.sonar.projectBaseDir=B
Shares.sonar.projectName=B
Shares.sonar.sources=.
Shares.sonar.cxx.includeDirectories=XXX
我需要弄清楚一些配置,但它有效,对我来说很好。
我配置了一个 Jenkins 主项目 P
来管理两个 git 存储库 A
和 B
。此主项目 P
仅更新 git 源并调用来自其工作区的源的声纳分析。
这是我的树文件夹。
{Jenkins Install Path} \ workspace \ P
|-- A
|-- .git/
|-- all projects A files
|-- B
|-- .git/
|-- all projects B files
当 Jenkins 为 P
运行声纳分析时,出现以下错误
SCM provider for this project is: git
2664 files to be analyzed
0/2664 files analyzed
Missing blame information for the following files:
(all files)
该错误是合乎逻辑的,因为 SonarQube 正在寻找 {Jenkins Install Path} \ workspace \ P
下的 .git
文件夹。它不存在。
我在互联网上四处寻找解决方案,但没有找到答案。我正在使用安装在 windows.
上的 SonarQube 5.5你有什么想法让 SonarQube 与我的配置一起工作吗?
这种情况与
我访问和阅读了几次的资料
您可以设置由 P
触发的分析作业。
分析作业可以带一个参数,应该分析 P
工作区内的哪个存储库。作业本身应该使用与 P
相同的工作区,并且只调用 SonarQube 分析。
根据@CSchulz 的回答,我找到了使用 SonarQube module
的解决方案我将 SonarQube 配置为使用对应于我的 A
和 B
git 项目的两个子模块。每个项目都将 git 模块的名称作为重要的 projectBaseDir
参数。
sonar.projectKey=P
sonar.projectName=P
sonar.projectVersion=4.0.0
sonar.binaries=.
sonar.cxx.includeDirectories=Common/Path
sonar.cxx.cppcheck.reportPath=cppCheckReport.xml # Reports are present in A and B forlder
# 2 modules definition
sonar.modules=A,B
# Module A
IHM.sonar.projectBaseDir=A
IHM.sonar.projectName=A
IHM.sonar.sources=.
IHM.sonar.cxx.includeDirectories=XXX
# Module B
Shares.sonar.projectBaseDir=B
Shares.sonar.projectName=B
Shares.sonar.sources=.
Shares.sonar.cxx.includeDirectories=XXX
我需要弄清楚一些配置,但它有效,对我来说很好。