简体   繁体   English

使用Jenkins和Sonarqube分析c#项目-调用MSBuild.SonarQube.Runner.exe结束时出错

[英]Analysis c# Project with Jenkins and Sonarqube - Error calling MSBuild.SonarQube.Runner.exe end

I am trying to analysis ac# project with SonarQube and Jenkins. 我正在尝试与SonarQube和Jenkins分析ac#项目。

I download the MSBuild SonarQube Runner plugin and I run my analyze to C# Project from the Command Line like this. 我下载了MSBuild SonarQube Runner插件,并像这样从命令行运行对C#项目的分析。

cd\\ 光盘\\

cd ci\\Test\\CodeCamper cd ci \\ Test \\ CodeCamper

rem --------------- STEP 1 ----------------- 雷姆---------------步骤1 -----------------

MSBuild.SonarQube.Runner.exe begin /k:ProjectCSharp:CodeCamper /n:CodeCamper /v:1.0 /d:sonar.resharper.cs.reportPath="c:\\ci\\test\\codecamper\\resharper.xml" /d:sonar.resharper.solutionFile="c:\\ci\\test\\codecamper\\CodeCamper.sln" MSBuild.SonarQube.Runner.exe开始/ k:ProjectCSharp:CodeCamper / n:CodeCamper /v:1.0 /d:sonar.resharper.cs.reportPath="c:\\ci\\test\\codecamper\\resharper.xml“ / d: sonar.resharper.solutionFile =“ c:\\ ci \\ test \\ codecamper \\ CodeCamper.sln”

rem --------------- STEP 2 ----------------- 雷姆---------------步骤2 -----------------

C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe "c:\\ci\\test\\codecamper\\CodeCamper.sln" /p:VisualStudioVersion=14.0 C:\\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319 \\ MSBuild.exe“ c:\\ ci \\ test \\ codecamper \\ CodeCamper.sln” /p:VisualStudioVersion=14.0

rem --------------- STEP 3 ----------------- 雷姆---------------步骤3 -----------------

"C:\\ci\\sonarqube\\AddOn\\JetBrains.ReSharper.CommandLineTools\\inspectcode.exe" /output="c:\\ci\\test\\codecamper\\resharper.xml" "c:\\ci\\test\\codecamper\\CodeCamper.sln" “ C:\\ ci \\ sonarqube \\ AddOn \\ JetBrains.ReSharper.CommandLineTools \\ inspectcode.exe” /output="c:\\ci\\test\\codecamper\\resharper.xml“” c:\\ ci \\ test \\ codecamper \\ CodeCamper.sln ”

rem --------------- STEP 4 ----------------- 雷姆---------------步骤4 -----------------

MSBuild.SonarQube.Runner.exe end MSBuild.SonarQube.Runner.exe结束

Run successfully. 运行成功。

Now I create a job in jenkins and call the cmds in the build step, i choose execute batch windows command. 现在,我在jenkins中创建一个作业,并在构建步骤中调用cmds,选择执行批处理Windows命令。 I put inside all the commands like before, and lunch the build. 我像以前一样放入所有命令,并午餐构建。

The step1 , step2 and step3 run successufully, but the step4, ends up with error. 步骤1,步骤2和步骤3成功运行,但步骤4最终以错误结束。

Started by user anonymous Building in workspace C:\\CI\\jenkins\\Jenkins\\jobs\\CodeCamper2\\workspace [workspace] $ cmd /c call C:\\WINDOWS\\TEMP\\hudson2830193841329867261.bat 由用户匿名启动在工作空间中构建C:\\ CI \\ jenkins \\ Jenkins \\ jobs \\ CodeCamper2 \\ workspace [workspace] $ cmd / c调用C:\\ WINDOWS \\ TEMP \\ hudson2830193841329867261.bat

C:\\CI\\jenkins\\Jenkins\\jobs\\CodeCamper2\\workspace>cd\\ C:\\ CI \\ jenkins \\ Jenkins \\ jobs \\ CodeCamper2 \\ workspace> cd \\

C:>cd ci\\Test\\CodeCamper C:> cd ci \\ Test \\ CodeCamper

C:\\CI\\Test\\CodeCamper>rem --------------- STEP 4 ----------------- C:\\ CI \\ Test \\ CodeCamper> rem ---------------步骤4 -----------------

C:\\CI\\Test\\CodeCamper>MSBuild.SonarQube.Runner.exe end Default properties file was found at C:\\CI\\sonarqube\\AddOn\\MSBuild.SonarQube.Runner\\SonarQube.Analysis.xml Loading analysis properties from C:\\CI\\sonarqube\\AddOn\\MSBuild.SonarQube.Runner\\SonarQube.Analysis.xml Post-processing started. C:\\ CI \\ Test \\ CodeCamper> MSBuild.SonarQube.Runner.exe结束缺省属性文件位于C:\\ CI \\ sonarqube \\ AddOn \\ MSBuild.SonarQube.Runner \\ SonarQube.Analysis.xml从C:\\加载分析属性CI \\ sonarqube \\ AddOn \\ MSBuild.SonarQube.Runner \\ SonarQube.Analysis.xml开始进行后处理。 WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. 警告:文件不在项目目录下,SonarQube当前无法对其进行分析。 File: D:\\TEMP.NETFramework,Version=v4.5.AssemblyAttributes.cs, project: c:\\ci\\test\\codecamper\\CodeCamper.Data.Contracts\\CodeCamper.Data.Contracts.csproj WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. 文件:D:\\ TEMP.NETFramework,Version = v4.5.AssemblyAttributes.cs,项目:c:\\ ci \\ test \\ codecamper \\ CodeCamper.Data.Contracts \\ CodeCamper.Data.Contracts.csproj警告:文件不在项目目录,SonarQube当前无法分析。 File: D:\\TEMP.NETFramework,Version=v4.5.AssemblyAttributes.cs, project: c:\\ci\\test\\codecamper\\CodeCamper.Data\\CodeCamper.Data.csproj WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. 文件:D:\\ TEMP.NETFramework,Version = v4.5.AssemblyAttributes.cs,项目:c:\\ ci \\ test \\ codecamper \\ CodeCamper.Data \\ CodeCamper.Data.csproj警告:文件不在项目目录下,并且不能目前由SonarQube分析。 File: D:\\TEMP.NETFramework,Version=v4.5.AssemblyAttributes.cs, project: c:\\ci\\test\\codecamper\\CodeCamper.Model\\CodeCamper.Model.csproj WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. 文件:D:\\ TEMP.NETFramework,Version = v4.5.AssemblyAttributes.cs,项目:c:\\ ci \\ test \\ codecamper \\ CodeCamper.Model \\ CodeCamper.Model.csproj警告:文件不在项目目录下,并且不能目前由SonarQube分析。 File: D:\\TEMP.NETFramework,Version=v4.5.AssemblyAttributes.cs, project: c:\\ci\\test\\codecamper\\CodeCamper.Web\\CodeCamper.Web.csproj The SONAR_RUNNER_HOME environment variable is not required and will be ignored. 文件:D:\\ TEMP.NETFramework,Version = v4.5.AssemblyAttributes.cs,项目:c:\\ ci \\ test \\ codecamper \\ CodeCamper.Web \\ CodeCamper.Web.csproj SONAR_RUNNER_HOME环境变量不是必需的,将被忽略。 SONAR_RUNNER_OPTS is not configured. SONAR_RUNNER_OPTS未配置。 Setting it to the default value of -Xmx1024m Calling the sonar-runner... Files was unexpected at this time. 将其设置为-Xmx1024m的默认值调用声纳运行器...此时文件意外。 The sonar-runner did not complete successfully 21:38:18.51 Creating a summary markdown file... Post-processing failed. 声纳运行器未成功完成21:38:18.51创建摘要降价文件...后处理失败。 Exit code: 1 退出码:1

C:\\CI\\Test\\CodeCamper>exit 1 Build step 'Execute Windows batch command' marked build as failure Finished: FAILURE. C:\\ CI \\ Test \\ CodeCamper>退出1生成步骤“执行Windows批处理命令”将生成标记为失败。完成:FAILURE。

What i am missing here? 我在这里想念什么?

My apologies for my bad english. 我为我的英语不好而道歉。

Best regards, 最好的祝福,

Lopes. 大腿。

Sorry for the late reply but just seen this post, seems your issue is on the sonnarqube end step 对不起,您的回复很晚,但刚才看到了这篇文章,似乎您的问题在Sonnarqube的最后一步

MSBuild.SonarQube.Runner.exe end Default properties file was found at C:\CI\sonarqube\AddOn\MSBuild.SonarQube.Runner\SonarQube.Analysis.xml

This could be caused due the XML for configuration is not in the same folder (exe, dll and xml have to be at the same level, in your case at C:\\CI\\sonarqube\\AddOn\\MSBuild.SonarQube.Runner). 这可能是由于用于配置的XML不在同一文件夹中(exe,dll和xml必须处于同一级别,在您的情况下,位于C:\\ CI \\ sonarqube \\ AddOn \\ MSBuild.SonarQube.Runner)。 As it is not there it tried to use a default configuration file but this wont have any of the information required to publish on your sonarqube server. 因为它不存在,所以它尝试使用默认配置文件,但这不会具有在声纳服务器上发布所需的任何信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM