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

查看:30
本文介绍了带有 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:SonarQubeinMSBuild.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)JenkinsworkspaceCI"
dotnet clean
dotnet build
C:SonarQubeinMSBuild.SonarQube.Runner.exe end

但是当我从 Jenkins 执行相同的命令时,我收到了这条消息:

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. 开始、构建或结束步骤并非全部从同一文件夹启动

我使用 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 build 没有使用 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天全站免登陆