在一个 VSTS 构建定义中扫描多个项目时,Sonarqube "Failed to create an empty directory"

标签 sonarqube azure-pipelines

我需要在每晚构建定义中为多个项目运行 Sonar 。我发现的问题是 - 在为第一个项目成功运行 sonarqube 后,.sonarqube文件夹已创建,并且进程似乎一直在使用该文件夹。因此,该文件夹不能被后续项目删除/使用。有没有办法解决这个问题?

enter image description here

第二个项目的准备步骤错误:

2017-06-08T22:43:53.0910761Z ##[error]Failed to create an empty directory 'C:\VSTS-Agent-2.104.0\_work\3\.sonarqube'. Please check that there are no open or read-only files in the directory and that you have the necessary read/write permissions.
2017-06-08T22:43:53.0910761Z ##[error]Detailed error message: The process cannot access the file 'newSummaryReport.md' because it is being used by another process.
2017-06-08T22:43:53.0910761Z ##[error]Pre-processing failed. Exit code: 1
2017-06-08T22:43:53.0910761Z ##[error]System.Exception: Unexpected exit code received from batch file: 1
2017-06-08T22:43:53.0910761Z    at Microsoft.TeamFoundation.DistributedTask.Task.Internal.InvokeBatchScriptCmdlet.ProcessRecord()
2017-06-08T22:43:53.0910761Z    at System.Management.Automation.CommandProcessor.ProcessRecord()
2017-06-08T22:43:53.1066882Z ##[error]PowerShell script completed with 1 errors.

最佳答案

我绕过这个问题:

  • 通过在 "Prepare analysis on SonarQube" 之前向管道添加删除文件任务任务;
  • 删除 ".sonarqube\out\"文件夹。源文件夹 "$(Agent.BuildDirectory)\.sonarqube\out\" ;
  • 一定要检查"Remove files starting with a dot"提前。
  • 关于在一个 VSTS 构建定义中扫描多个项目时,Sonarqube "Failed to create an empty directory",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44447173/

    相关文章:

    java - 无法找到Sonarqube各个版本之间的差异

    java - sonarQube 包装器已停止

    java - SonarQube Java插件自定义规则

    azure - 如何使用Azure Pipelines将桌面应用程序部署到物理服务器?

    powershell - 添加错误以从 VSTS 中运行的 PowerShell 脚本构建摘要

    java - 配置项目后,SonarQube 未在仪表板中显示任何问题

    gradle - 分支的 SonarQube 覆盖范围

    Linux 构建代理上的 Azure powershell 任务抛出当前操作系统无法运行此任务

    azure - Azure 灾难恢复的替代方法

    azure-devops - 使用LOCAL代理在Azure Pipelines中运行测试期间有成千上万的E0434352.CLR异常