首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SonarQube MSBuild集成失败: SonarQube无法收集项目所需的信息。

SonarQube MSBuild集成失败: SonarQube无法收集项目所需的信息。
EN

Stack Overflow用户
提问于 2016-12-30 11:45:34
回答 2查看 17.4K关注 0票数 9

我安装了这样的..。

声纳-6.2声纳-扫描仪-2.8倍声纳-扫描仪- msbuild -2.2.0.24

我制作了windows批处理文件来构建和扫描(声纳)。但有些项目没问题。但有些项目失败了。

批处理文件是..。

MSBuild.SonarQube.Runner.exe begin /k:%PROJECT_KEY% /n:%PROJECT_NAME% /v:%BUILD_VERSION% /d:sonar.verbose=true MSBuild.exe "projects“/t:build /v:m MSBuild.SonarQube.Runner.exe结束

错误信息是..。

在C:\SONARQUBE\sonar-scanner-msbuild-2.2.0.24\SonarQube.Analysis.xml加载分析属性时,从C:\SONARQUBE\sonar-scanner-msbuild-2.2.0.24\SonarQube.Analysis.xml后处理开始找到SonarQube Scanner for MSBuild 2.2默认属性文件。从C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.sonarqube\conf\SonarQubeAnalysisConfig.xml 18:50:20.592加载SonarQube分析配置的SonarQube扫描程序: MSBuild 2.2 18:50:20.591没有在TeamBuild 18:50:20.593分析基目录: C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.sonarqube构建目录: Bin目录: C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.sonarqube\bin config目录下运行:C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.sonarqube\conf输出目录: C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.sonarqube\out Config文件: C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.sonarqube\conf\SonarQubeAnalysisConfig.xml生成SonarQube项目属性文件到C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.sonarqube\out\sonar-project.properties SonarQube MSBuild集成失败: SonarQube无法收集有关项目的所需信息。 可能的原因:

  1. 项目尚未构建-项目必须在开始步骤和结束步骤之间构建。
  2. MSBuild的一个不受支持的版本已用于构建该项目。目前支持MSBuild 12.0以上
  3. “开始”、“生成”或“结束”步骤并不都是从同一个文件夹启动的。

将处理摘要写入声纳属性文件的C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.sonarqube\out\ProjectInfo.log生成失败。无法完成SonarQube分析。18:50:20.615创建一个摘要标记文件..。18:50:20.617后处理失败。出口代码:1

我为声纳执行了同样的批处理文件。但有些项目没问题。有些项目失败了。是什么导致了这条错误消息?

EN

回答 2

Stack Overflow用户

发布于 2017-08-31 23:23:30

在teamcity中运行MSBuild.SonarQube.Runner end命令时,我也遇到了类似的错误。构建项目的开始步骤和MSBuild步骤运行良好。

当我给跑步者和团队中的MSbuild提供完整的路径时。对我起作用了。

代码语言:javascript
复制
C:\SonarQube\sonar-scanner-msbuild-3.0.2.656\MSBuild.Sonarqube.runner.exe 
begin /k:"Sonar key here" /n:"Sonar project here" /v:%build.number% 
/d:sonar.log.level=DEBUG 

"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" [path for .sln file 
here] /t:Rebuild 
/p:VisualStudioversion=14.0;Configuration=Release;Platform="Any CPU"

C:\SonarQube\sonar-scanner-msbuild-3.0.2.656\MSBuild.Sonarqube.runner end
票数 3
EN

Stack Overflow用户

发布于 2018-02-14 18:29:28

另一件值得检查的事情--尤其是当您试图从构建服务器上运行SonarQube时--是它是否在本地系统配置文件中运行。从日志中可以看到如下内容:

代码语言:javascript
复制
Installed SonarQube.Integration.ImportBefore.targets to C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportBefore

我发现这个路径并不存在,尽管SonarQube的扫描器很高兴地宣称已经在那里安装了它的目标。我的解决方案是创建一个用于执行构建任务的构建代理帐户。这将导致SonarQube将其目标安装到用户配置文件MSBuild文件夹中。例如:

代码语言:javascript
复制
C:\Users\buildagent\AppData\Local\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportBefore
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41395737

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档