我无法在jenkins中运行sonarqube msbuild runner v1.0.2。 构建运行正常,但插件似乎没有正确导入声纳目标。
这是声纳构建开始时的日志:
[workspace] $C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\MSBuild.SonarQube.Runner.exe begin /k:my.project /n:myprojectname /v:1.0 /d:sonar.host.url=http://1.1.1.1:9000/
MSBuild SonarQube Runner Bootstrapper 1.0.2.0
Default properties file was found at C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Loading analysis properties from C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
Checking for updates...
MSBuild SonarQube Runner Pre-processor 1.0.2.0
10:17:18.025 Loading analysis properties from C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
10:17:18.056 Updating build integration targets...
10:17:18.072 Fetching analysis configuration settings...
10:17:21.332 Generating rulesets...
Pre-processing succeeded.
Path To MSBuild.exe: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
Executing the command cmd.exe /C " C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Development /t:Clean,Build /tv:14.0 /p:VisualStudioVersion=14.0 /m:1 /fl2 /flp2:verbosity=diagnostic myprojectname.sln " && exit %%ERRORLEVEL%% from C:\.jenkins\jobs\Technology - WWW - Content Store Client\workspace
[workspace] $ cmd.exe /C " C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Development /t:Clean,Build /tv:14.0 /p:VisualStudioVersion=14.0 /m:1 /fl2 /flp2:verbosity=diagnostic ContentStoreClientSolution.sln " && exit %%ERRORLEVEL%%
Microsoft (R) Build Engine version 4.6.81.0...
在这里,如果完成:
[workspace] $ C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\MSBuild.SonarQube.Runner.exe end
MSBuild SonarQube Runner Bootstrapper 1.0.2.0
Default properties file was found at C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Loading analysis properties from C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Post-processing started.
No ProjectInfo.xml files were found. Possible causes: you specified an invalid build configuration or the custom MSBuild analysis targets were not imported.
MSBuild SonarQube Runner Post-processor 1.0.2.0
Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
10:21:04.257 Creating a summary markdown file...
Post-processing failed. Exit code: 1
ERROR: Execution of MSBuild SonarQube Runner failed (exit code 1)
该插件将自己安装在jenkins的工具子文件夹中。但是,查看项目工作区,我可以看到一个名为.sonar的文件夹,其中包含所有正确的文件和目标等。
关于构建失败原因的任何想法?
答案 0 :(得分:1)
您至少需要使用MSBuild 12(版本14,随VS 2015一起发货,将为您提供更准确的分析结果,其中包含适用于MSBuild和C#插件4.4的SonarQube扫描仪1.1版。)
未为MSBuild 4.0部署ImportsBefore
目标 - 这就是为什么在MSBuild执行期间不会收集任何信息的原因。我们不会添加对MSBuild 4.0或更早版本的支持。
请注意,在即将推出的SonarQube Scanner for MSBuild 1.1版本中,提及ProjectInfo.xml
的错误消息已经大大改进,让您了解潜在的根本原因:请参阅https://jira.sonarsource.com/browse/SONARMSBRU-180