禁用将 TfsBuild 中的 NPM 构建步骤结果推送到 SonarQube

Disable to Push NPM Build step results in TfsBuild to SonarQube

我有一个 UI 项目(HTML、CSS、Angular2.0)

我想将它添加到 sonarqube,我们正在使用 TFS 进行构建。

我有以下步骤

分解后它们看起来如下 步骤 1 第 2 步 第 3 步 第 4 步 第 5 步 第 6 步

我得到的异常如下

 ##[error]The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.

您实际上是在使用 SonarQube Scanner for MSBuild(顾名思义,它只有在您执行 MSBuild 步骤时才有效)。使用当前任务,您无法像您想做的那样分析 Web 项目。将会有一个新版本的 SonarQube 扩展,包括允许这样做的 CLI 的 SonarQube 扫描器。

目前,我能想到的唯一解决方案是为 CLI 包含 SonarQube Scanner 的二进制文件,并在 npm Build 之后添加一个命令行步骤(您需要删除 Begin Analysis和结束分析)将进行分析。

有关 CLI 扫描程序的更多信息 here