具有dotnet核心的Sonarqube在命令行上可以正常运行,但不能在Jenkins上运行 [英] Sonarqube with dotnet core works fine on command line but not from Jenkins

查看:172
本文介绍了具有dotnet核心的Sonarqube在命令行上可以正常运行,但不能在Jenkins上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Windows上的SOnarQube MsBuild在Jenkins的.NET Core 2.0解决方案上启动Sonarqube.

I'm trying to launch Sonarqube on a .NET Core 2.0 solution from Jenkins using SOnarQube MsBuild on Windows.

当我从Jenkins工作区执行以下脚本时,它工作正常:

It works fine when i execute the following script from Jenkins workspace:

C:\SonarQube\bin\MSBuild.SonarQube.Runner.exe begin /k:XXXX.Campaigns /n:CI /v: /d:sonar.host.url=http://x.x.x.x:9000 /d:sonar.verbose=true /d:sonar.projectBaseDir="C:\Program Files (x86)\Jenkins\workspace\CI"
dotnet clean
dotnet build
C:\SonarQube\bin\MSBuild.SonarQube.Runner.exe end

但是当我从詹金斯执行相同的命令时,我得到了以下消息:

But when i execute the same command from Jenkins, i got this message:

SonarQube MSBuild集成失败:SonarQube是 无法收集有关您的项目的必需信息. 可能的原因:

The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects. Possible causes:

  1. 该项目尚未建立-该项目必须建立在 在开始步骤和结束步骤之间.
  2. 不受支持的MSBuild版本 已用于构建项目.当前MSBuild 14.0以上
  3. 开始,构建或结束步骤尚未全部完成 从同一文件夹启动
  1. The project has not been built - the project must be built in between the begin and end steps.
  2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0 upwards
  3. The begin, build or end steps have not all been launched from the same folder

我使用Jenkins 2.46.2-MSBuild 15-Sonarqube 6.7&声纳MsBuild 4.0.2.892.我尝试使用Jenkins的构建步骤,命令步骤,带有脚本的命令步骤而没有成功.在经典的.Net 4.5.2项目中,它可以工作.

I use Jenkins 2.46.2 - MSBuild 15 - Sonarqube 6.7 & Sonar MsBuild 4.0.2.892. I tried using Jenkins build steps, command step, command step with a script without success. On a classical .Net 4.5.2 project, it works.

推荐答案

Jenkins以本地系统用户身份运行.我将其更改为普通的Windows用户,并且成功了. dotnet构建未使用Sonarqube专用目标. 谢谢@Valeri!

Jenkins was running as local system user. I change it to a normal Windows user and it did the trick. dotnet build was not using Sonarqube dedicated targets. Thanks you @Valeri!

这篇关于具有dotnet核心的Sonarqube在命令行上可以正常运行,但不能在Jenkins上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆