SonarQube 6.5 - 无法触发TFS构建定义

时间:2017-10-19 19:30:17

标签: sonarqube tfsbuild tfs2015 sonarqube-scan

我已将SonarQube - Begin Analysis和End Analysis任务添加到我的TFS Build定义中。我启动并运行了SonarQube服务器。我添加了一个SonarQube服务端点,并在配置SonarQube Begin分析任务时添加了它。

然而,当我触发构建时,它无法抛出以下错误 - '未处理的异常:System.IO.InvalidDataException:无法找到中央目录记录的结尾。'

知道问题可能是什么? 我正在使用SonarQube 6.5版本。

 Starting: Get sources

 Running tasks

 Starting task: Fetch the Quality Profile from SonarQube

 Executing the powershell script: c:\Program
 Files\TFS2015Agent\tasks\SonarQubePreBuild\1.0.34\SonarQubePreBuild.ps1
 SonarQube Scanner for MSBuild 1.1 Default properties file was not
 found at C:\Program
 Files\TFS2015Agent\tasks\SonarQubePreBuild\1.0.34\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml

 Pre-processing started. Preparing working directories... Checking for
 updates... Unhandled Exception: System.IO.InvalidDataException: End of
 Central Directory record could not be found. 


 at System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory() 
 at System.IO.Compression.ZipArchive.Init(Stream stream, ZipArchiveMode mode, Boolean leaveOpen)
 at System.IO.Compression.ZipArchive..ctor(Stream stream, ZipArchiveMode mode, Boolean leaveOpen, Encoding entryNameEncoding)
 at System.IO.Compression.ZipFile.Open(String archiveFileName, ZipArchiveMode mode, Encoding entryNameEncoding)
 at System.IO.Compression.ZipFile.ExtractToDirectory(String sourceArchiveFileName, String destinationDirectoryName, Encoding entryNameEncoding)
 at SonarQube.Bootstrapper.BuildAgentUpdater.TryUpdate(String hostUrl, String targetDir, ILogger logger)
 at SonarQube.Bootstrapper.Program.PreProcess(IBuildAgentUpdater updater, IBootstrapperSettings settings, ILogger logger)
 at SonarQube.Bootstrapper.Program.Execute(String[] args, IBuildAgentUpdater updater, ILogger logger)
 at SonarQube.Bootstrapper.Program.Main(String[] args)

1 个答案:

答案 0 :(得分:1)

要解决此问题,我必须在TFS中下载latest version of the SonarQube build tasks。最简单的选择是导航到服务器上的Admin TFS扩展页面,并使用它来下载和安装更新的SonarQube扩展。

enter image description here

一旦完成,我触发了TFS构建并且能够通过此错误。