用于MSBuild&;的SonarQube扫描仪出错的可能原因;TFS 2015
我已经安装了TFS 2015更新3,其中包括几个项目。它们中的每一个都有自己的构建定义,而且其中一些构建定义包括SonarQube for MS构建任务(begin-end)。到目前为止,我在另一台机器上设置了1个构建代理,作为构建服务器,并使用SonarQube 5.6实例 我已经为如何解决这个问题苦苦挣扎了两天,这个问题只出现在一个构建定义中:用于MSBuild&;的SonarQube扫描仪出错的可能原因;TFS 2015,msbuild,sonarqube,tfsbuild,sonar-runner,Msbuild,Sonarqube,Tfsbuild,Sonar Runner,我已经安装了TFS 2015更新3,其中包括几个项目。它们中的每一个都有自己的构建定义,而且其中一些构建定义包括SonarQube for MS构建任务(begin-end)。到目前为止,我在另一台机器上设置了1个构建代理,作为构建服务器,并使用SonarQube 5.6实例 我已经为如何解决这个问题苦苦挣扎了两天,这个问题只出现在一个构建定义中: 2016-10-11T18:29:54.0515420Z Generating SonarQube project properties file
2016-10-11T18:29:54.0515420Z Generating SonarQube project properties file to c:\_work\4\.sonarqube\out\sonar-project.properties
2016-10-11T18:29:54.0525412Z ##[error]The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
2016-10-11T18:29:54.0525412Z ##[error]Possible causes:
2016-10-11T18:29:54.0535414Z ##[error]1. The project has not been built - the project must be built in between the begin and end steps
2016-10-11T18:29:54.0535414Z ##[error]2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 12.0 upwards are supported
2016-10-11T18:29:54.0545417Z ##[error]3. The begin, build or end steps have not all been launched from the same folder
检查此错误时,我分析了可能的原因:
{
"build": [
{
"enabled": true,
"continueOnError": false,
"alwaysRun": false,
"displayName": "Fetch the Quality Profile from SonarQube",
"task": {
"id": "eae5b2cc-ac5e-4cba-b022-a06621f9c01f",
"versionSpec": "*"
},
"inputs": {
"projectKey": "PROJECT1",
"projectName": "PROJECT1",
"projectVersion": "1.0",
"connectedServiceName": "ab3a4128-62ca-4e35-88f0-a2c6aae2a123",
"dbUrl": "",
"dbUsername": "",
"dbPassword": "",
"cmdLineArgs": "/d:sonar.verbose=true",
"configFile": "",
"breakBuild": "false"
}
},
{
"enabled": true,
"continueOnError": false,
"alwaysRun": false,
"displayName": "Build solution $(Build.SourcesDirectory)\\XXXX\\Build.proj",
"task": {
"id": "c6c4c611-aa2e-4a33-b606-5eaba2196824",
"versionSpec": "*"
},
"inputs": {
"solution": "$(Build.SourcesDirectory)\\XXXX\\Build.proj",
"platform": "$(BuildPlatform)",
"configuration": "$(BuildConfiguration)",
"msbuildArguments": "/p:BuildingInsideVisualStudio=true;FullBuild=true",
"clean": "false",
"restoreNugetPackages": "false",
"logProjectEvents": "false",
"msbuildLocationMethod": "version",
"msbuildVersion": "14.0",
"msbuildArchitecture": "x86",
"msbuildLocation": ""
}
},
{
"enabled": true,
"continueOnError": true,
"alwaysRun": false,
"displayName": "Test Assemblies $(Build.SourcesDirectory)\\Droplocation\\**\\XXXX*test*.dll",
"task": {
"id": "ef087383-ee5e-42c7-9a53-ab56c98420f9",
"versionSpec": "*"
},
"inputs": {
"testAssembly": "$(Build.SourcesDirectory)\\Droplocation\\**\\XXXX*test*.dll",
"testFiltercriteria": "",
"runSettingsFile": "$(Build.SourcesDirectory)\\Environment\\Test.runsettings",
"overrideTestrunParameters": "",
"codeCoverageEnabled": "true",
"runInParallel": "false",
"vsTestVersion": "latest",
"pathtoCustomTestAdapters": "",
"otherConsoleOptions": "",
"testRunTitle": "",
"platform": "$(BuildPlatform)",
"configuration": "$(BuildConfiguration)",
"publishRunAttachments": "true"
}
},
{
"enabled": true,
"continueOnError": false,
"alwaysRun": false,
"displayName": "Finish the analysis and upload the results to SonarQube",
"task": {
"id": "730d8de1-7a4f-424c-9542-fe7cc02604eb",
"versionSpec": "*"
},
"inputs": {}
},
{
"enabled": false,
"continueOnError": false,
"alwaysRun": false,
"displayName": "Publish Artifact: $(BuildConfiguration)",
"task": {
"id": "1d341bb0-2106-458c-8422-d00bcea6512a",
"versionSpec": "*"
},
"inputs": {
"CopyRoot": "droplocation\\Build\\$(BuildPlatform)\\$(BuildConfiguration)",
"Contents": "**\\*",
"ArtifactName": "$(BuildConfiguration)",
"ArtifactType": "FilePath",
"TargetPath": "\\\\SERVER0009\\PROJECT1\\Dev\\FT1\\Droplocation\\Build\\$(BuildPlatform)"
}
}
],
"options": [
{
"enabled": false,
"definition": {
"id": "7c555368-ca64-4199-add6-9ebaf0b0137d"
},
"inputs": {
"multipliers": "[]",
"parallel": "false",
"continueOnError": "true",
"additionalFields": "{}"
}
},
{
"enabled": false,
"definition": {
"id": "a9db38f9-9fdc-478c-b0f9-464221e58316"
},
"inputs": {
"workItemType": "61",
"assignToRequestor": "true",
"additionalFields": "{}"
}
},
{
"enabled": false,
"definition": {
"id": "57578776-4c22-4526-aeb0-86b6da17ee9c"
},
"inputs": {
"additionalFields": "{}"
}
}
],
"triggers": [
{
"schedules": [
{
"branchFilters": [
"+$/PROJECT1"
],
"timeZoneId": "SA Pacific Standard Time",
"startHours": 2,
"startMinutes": 0,
"daysToBuild": 31,
"scheduleJobId": "d4f0f8c0-00c1-433a-af52-9e1b9e5c3b0c"
}
],
"triggerType": 8
}
],
"variables": {
"BuildPlatform": {
"value": "AnyCPU"
},
"BuildConfiguration": {
"value": "Debug"
},
"system.debug": {
"value": "true"
}
},
"demands": [
"gulp",
"server"
],
"retentionRules": [
{
"branches": [
"+refs/heads/*"
],
"artifacts": [
"build.SourceLabel"
],
"daysToKeep": 10,
"minimumToKeep": 1,
"deleteBuildRecord": true,
"deleteTestResults": true
}
],
"_links": {
"self": {
"href": "http://SERVERexptfs1:8080/tfs/DevOpsCollection/82853fb4-72eb-4847-8fe3-405d951fdc67/_apis/build/Definitions/6"
},
"web": {
"href": "http://SERVERexptfs1:8080/tfs/_permalink/_build/index?collectionId=498d3af0-ad32-4e5c-9870-7b5ad0346571&projectId=82853fb4-72eb-4847-8fe3-405d951fdc67&definitionId=6"
}
},
"jobAuthorizationScope": 1,
"jobTimeoutInMinutes": 60,
"repository": {
"properties": {
"labelSources": "0",
"tfvcMapping": "{\"mappings\":[{\"serverPath\":\"$/PROJECT1/Dev/FT1\",\"mappingType\":\"map\",\"localPath\":\"\\\\\"},{\"serverPath\":\"$/PROJECT1/Dev/FT1/Workspaces\",\"mappingType\":\"cloak\",\"localPath\":\"\\\\Workspaces\"},{\"serverPath\":\"$/PROJECT1/Dev/FT1/Documentation\",\"mappingType\":\"cloak\",\"localPath\":\"\\\\Documentation\"}]}"
},
"id": "$/",
"type": "TfsVersionControl",
"name": "PROJECT1",
"url": "http://SERVERexptfs1:8080/tfs/DevOpsCollection/",
"defaultBranch": "$/PROJECT1/Dev/FT1",
"rootFolder": "$/PROJECT1",
"clean": "false",
"checkoutSubmodules": false
},
"quality": 1,
"authoredBy": {
"id": "70764a8f-5a60-4969-a13b-771c30beaae8",
"displayName": "Cristian Galindo Londono",
"uniqueName": "XXXXINSPECTION\\CGLondono",
"url": "http://SERVERexptfs1:8080/tfs/DevOpsCollection/_apis/Identities/70764a8f-5a60-4969-a13b-771c30beaae8",
"imageUrl": "http://SERVERexptfs1:8080/tfs/DevOpsCollection/_api/_common/identityImage?id=70764a8f-5a60-4969-a13b-771c30beaae8"
},
"queue": {
"pool": {
"id": 1,
"name": "Default"
},
"id": 1,
"name": "Default"
},
"uri": "vstfs:///Build/Definition/6",
"type": 2,
"revision": 39,
"createdDate": "2016-10-13T13:56:02.600Z",
"id": 6,
"name": "FT1.Build.Sonar",
"url": "http://SERVERexptfs1:8080/tfs/DevOpsCollection/82853fb4-72eb-4847-8fe3-405d951fdc67/_apis/build/Definitions/6",
"project": {
"id": "82853fb4-72eb-4847-8fe3-405d951fdc67",
"name": "PROJECT1",
"url": "http://SERVERexptfs1:8080/tfs/DevOpsCollection/_apis/projects/82853fb4-72eb-4847-8fe3-405d951fdc67",
"state": "wellFormed",
"revision": 31
}
}
经过大量挖掘、牺牲和诅咒,我发现SonarQube runner用于MSBuild的目标被跳过
其中一个目标(SonarQubeImportBeforeInfo)的条件是
buildingSideVisualStudio!='true'
。我对另一个内部目标使用了相同的变量(巧合)你能和我们分享一下这个问题的副本吗?似乎结束步骤找不到.sonarqube/out文件夹,或者该文件夹不包含任何相关信息(ProjectInfo.xml文件)。您的解决方案中有哪些类型的项目?由于该问题只发生在一个生成定义中,因此该问题不应与TFS环境相关。您能告诉我们您在这个构建定义中使用的是什么类型的项目吗?根据该网站,不支持BizTalk、SharePoint、ASP.NET vNext项目和网站解决方案的分析。它是一组c#library项目。事实上,在文件夹.sonarqube/out文件夹中没有与项目相关的信息。我处于调查模式,由于此构建定义正在运行,试图找出哪些更改并影响其正常工作我创建了一个powershell脚本来执行该流程,并且运行良好,为什么TFS任务继续失败???grrrrr您能否共享详细的构建定义设置和测试项目?