VSTS SonarQube error ArgumentNullException: Value cannot be null - tfs

Is anyone familiar with this error and how to solve it? I'm using Sonarqube Scanner 2.3.1 provided by VSTS build and releases. I can't find a solution to this problem on the internet. I've followed the steps on https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Extension+for+VSTS-TFS. Based on the log below, something seems to go wrong with "GetActiveRules()". SonarQube server version used is 6.3.
2017-12-19T14:47:51.7143720Z ##[section]Starting: Prepare the SonarQube analysis
2017-12-19T14:47:51.7353647Z ==============================================================================
2017-12-19T14:47:51.7354146Z Task : SonarQube Scanner for MSBuild - Begin Analysis (new)
2017-12-19T14:47:51.7354696Z Description : Prepare the SonarQube analysis of your solution
2017-12-19T14:47:51.7354860Z Version : 2.0.0
2017-12-19T14:47:51.7355026Z Author : sonarsource
2017-12-19T14:47:51.7355220Z Help : Version: 2.0.0. [More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
2017-12-19T14:47:51.7355431Z ==============================================================================
2017-12-19T14:47:51.7628359Z Preparing task execution handler.
2017-12-19T14:47:57.6434164Z Executing the powershell script: d:\a\_tasks\SonarQubeScannerMsBuildBegin_15b84ca1-b62f-4a2a-a403-89b77a063157\2.0.0\SonarQubePreBuild.ps1
2017-12-19T14:47:58.3703010Z
2017-12-19T14:47:58.3703167Z
2017-12-19T14:48:00.4422238Z SonarQube Scanner for MSBuild 2.2
2017-12-19T14:48:00.4422634Z Default properties file was found at D:\a\_tasks\SonarQubeScannerMsBuildBegin_15b84ca1-b62f-4a2a-a403-89b77a063157\2.0.0\SonarQubeScannerMsBuild\SonarQube.Analysis.xml
2017-12-19T14:48:00.4423006Z Loading analysis properties from D:\a\_tasks\SonarQubeScannerMsBuildBegin_15b84ca1-b62f-4a2a-a403-89b77a063157\2.0.0\SonarQubeScannerMsBuild\SonarQube.Analysis.xml
2017-12-19T14:48:00.4423338Z sonar.verbose=true was specified - setting the log verbosity to 'Debug'
2017-12-19T14:48:00.4423542Z Pre-processing started.
2017-12-19T14:48:00.4424077Z Preparing working directories...
2017-12-19T14:48:00.4424265Z Using environment variables to determine the download directory...
2017-12-19T14:48:00.4424445Z Using environment variable 'AGENT_BUILDDIRECTORY', value 'd:\a\1'
2017-12-19T14:48:00.4424630Z Creating directory: d:\a\1\.sonarqube
2017-12-19T14:48:00.4424794Z SonarQube server URL: http://redacted.net:443/
2017-12-19T14:48:00.4424971Z SonarQube Scanner for MSBuild 2.2
2017-12-19T14:48:00.4425192Z 14:47:59.003 Loading analysis properties from D:\a\_tasks\SonarQubeScannerMsBuildBegin_15b84ca1-b62f-4a2a-a403-89b77a063157\2.0.0\SonarQubeScannerMsBuild\SonarQube.Analysis.xml
2017-12-19T14:48:00.4425445Z 14:47:59.009 sonar.verbose=true was specified - setting the log verbosity to 'Debug'
2017-12-19T14:48:00.4425633Z 14:47:59.062 Updating build integration targets...
2017-12-19T14:48:00.4426049Z 14:47:59.065 Installed SonarQube.Integration.ImportBefore.targets to C:\Users\buildguest\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore
2017-12-19T14:48:00.4426656Z 14:47:59.065 Installed SonarQube.Integration.ImportBefore.targets to C:\Users\buildguest\AppData\Local\Microsoft\MSBuild\12.0\Microsoft.Common.targets\ImportBefore
2017-12-19T14:48:00.4427081Z 14:47:59.066 Installed SonarQube.Integration.targets to d:\a\1\.sonarqube\bin\targets
2017-12-19T14:48:00.4427645Z 14:47:59.067 Creating config and output folders...
2017-12-19T14:48:00.4427824Z 14:47:59.067 Creating directory: d:\a\1\.sonarqube\conf
2017-12-19T14:48:00.4427991Z 14:47:59.067 Creating directory: d:\a\1\.sonarqube\out
2017-12-19T14:48:00.4428155Z 14:47:59.1 Fetching analysis configuration settings...
2017-12-19T14:48:00.4428368Z 14:47:59.264 Fetching properties for project 'redacted' from http://redacted.net:443/api/properties?resource=redacted...
2017-12-19T14:48:00.4430680Z 14:47:59.264 Downloading from http://redacted.net:443/api/properties?resource=redacted...
2017-12-19T14:48:00.4430970Z 14:47:59.866 Downloading from http://redacted.net:443/api/updatecenter/installed_plugins...
2017-12-19T14:48:00.4431258Z 14:48:00.016 Fetching quality profile for project 'redacted' from http://redacted.net:443/api/qualityprofiles/search?projectKey=redacted...
2017-12-19T14:48:00.4431629Z 14:48:00.016 Downloading from http://redacted.net:443/api/qualityprofiles/search?projectKey=redacted...
2017-12-19T14:48:00.4431954Z 14:48:00.211 Downloading from http://redacted.net:443/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&activation=true&qprofile=cs-redacted-63418&p=1...
2017-12-19T14:48:00.7438998Z ##[error]
2017-12-19T14:48:00.9448180Z ##[error]Unhandled Exception: System.ArgumentNullException: Value cannot be null.
2017-12-19T14:48:00.9448811Z ##[error]Parameter name: source
2017-12-19T14:48:00.9449032Z ##[error]at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
2017-12-19T14:48:00.9449485Z ##[error]at SonarQube.TeamBuild.PreProcessor.SonarWebService.<>c__DisplayClass6_0.<GetActiveRules>b__0(JObject r)
2017-12-19T14:48:00.9449717Z ##[error]at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
2017-12-19T14:48:00.9449967Z ##[error]at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
2017-12-19T14:48:00.9450225Z ##[error]at SonarQube.TeamBuild.PreProcessor.SonarWebService.GetActiveRules(String qprofile)
2017-12-19T14:48:00.9450833Z ##[error]at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary`2& serverSettings, List`1& analyzersSettings)
2017-12-19T14:48:00.9451189Z ##[error]at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs args)
2017-12-19T14:48:00.9451450Z ##[error]at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.Execute(String[] args)
2017-12-19T14:48:00.9451708Z ##[error]at SonarQube.Bootstrapper.BootstrapperClass.PreProcess()
2017-12-19T14:48:00.9451927Z ##[error]at SonarQube.Bootstrapper.BootstrapperClass.Execute()
2017-12-19T14:48:00.9452161Z ##[error]at SonarQube.Bootstrapper.Program.Main(String[] args)
2017-12-19T14:48:00.9452379Z ##[error]at SonarQube.Old.Bootstrapper.Program.Main(String[] args)
2017-12-19T14:48:06.4313573Z ##[error]System.Exception: Unexpected exit code received from batch file: -532462766
2017-12-19T14:48:06.4314025Z at Microsoft.TeamFoundation.DistributedTask.Task.Internal.InvokeBatchScriptCmdlet.ProcessRecord()
2017-12-19T14:48:06.4314270Z at System.Management.Automation.CommandProcessor.ProcessRecord()
2017-12-19T14:48:06.4976374Z ##[error]PowerShell script completed with 1 errors.
2017-12-19T14:48:06.4983562Z ##[section]Finishing: Prepare the SonarQube analysis

Related

SonarQube Scanner Error while running the sonar qube from Jenkins build pipeline

Part of the Jenkins build pipeline we were running the sonar qube code scan and was working fine, only few days ago it started throwing error as mentioned below
Sonar Qube version: 6.7.6 (build 38781)
Sonar Scanner version: sonar-scanner-3.3.0.1492-windows
(Env variable) SONAR_SCANNER : C:\sonar-scanner-3.3.0.1492-windows
00:44:26.810 ERROR: Error during SonarQube Scanner execution
00:44:26.810 ERROR: Unable to load component class org.sonar.scanner.bootstrap.ScannerPluginInstaller
00:44:26.810 ERROR: Caused by: Unable to load component class org.sonar.home.cache.FileCache
00:44:26.810 ERROR: Caused by: Unable to load component class org.sonar.scanner.bootstrap.GlobalConfiguration
00:44:26.810 ERROR: Caused by: Not authorized. Please check the properties sonar.login and sonar.password.
We cannot upgrade to newer version , I would like to understand what is causing the issue for Sonar to fail. Appreciate your responses.
From Admin page (Sonarqube) give access to use to run execute sonar analysis and then
generate login token from UI .
_ **use propertyb in sonar.properties file** _
sonar.login=token

Could not find a file on the SonarQube server. Url: http://server:9081/static/csharp/SonarQube.MSBuild.Runner.Implementation.zip

SonarQube - 5.3
C# Plugin - 5.0
SonarQube Scanner 2.1
TFS 2015 Update 2.1
When I execute build on build server, it says
Could not find a file on the SonarQube server. Url: http://server:9081/static/csharp/SonarQube.MSBuild.Runner.Implementation.zip
I can login to Sonar server, I have also added path of Sonar MSBuild.SonarQube.Runner.exe in path variable under environment variables.
Am I missing anything here?
Can anybody please help me to solve this?
2016-07-18T12:20:40.6290351Z Checking if artifacts directory exists: D:\BuildAgent\_work\8\a
2016-07-18T12:20:40.6290351Z Deleting artifacts directory.
2016-07-18T12:20:40.6330353Z Creating artifacts directory.
2016-07-18T12:20:40.6330353Z Checking if test results directory exists: D:\BuildAgent\_work\8\TestResults
2016-07-18T12:20:40.6330353Z Deleting test results directory.
2016-07-18T12:20:40.6340353Z Creating test results directory.
2016-07-18T12:20:40.6880384Z Starting: Get sources
2016-07-18T12:20:40.6930387Z Entering TfsGitSourceProvider.PrepareRepositoryAsync
2016-07-18T12:20:40.6930387Z localPath=D:\BuildAgent\_work\8\s
2016-07-18T12:20:40.6930387Z clean=False
2016-07-18T12:20:40.6930387Z sourceBranch=refs/heads/master
2016-07-18T12:20:40.6930387Z sourceVersion=8a38426975d589b8ba02ae545fa989588221143c
2016-07-18T12:20:40.6940388Z Syncing repository: PSA (Git)
2016-07-18T12:20:40.6940388Z repository url=http://server:8080/tfs/AjayTestCollection/_git/PSA
2016-07-18T12:20:40.6950388Z checkoutSubmodules=False
2016-07-18T12:20:40.7570424Z Starting fetch...
2016-07-18T12:20:40.9230519Z Checking out 8a38426975d589b8ba02ae545fa989588221143c to D:\BuildAgent\_work\8\s
2016-07-18T12:20:40.9570538Z Checked out branch refs/heads/master for repository PSA at commit 8a38426975d589b8ba02ae545fa989588221143c
2016-07-18T12:20:40.9570538Z commit=8a38426975d589b8ba02ae545fa989588221143c
2016-07-18T12:20:40.9570538Z Leaving TfsGitSourceProvider.PrepareRepositoryAsync
2016-07-18T12:20:41.0360583Z Running tasks
2016-07-18T12:20:41.0510592Z Starting task: NuGet restore **\*.sln
2016-07-18T12:20:41.0770607Z Set workingFolder to default: D:\BuildAgent\tasks\NuGetInstaller\0.1.17
2016-07-18T12:20:41.1000620Z Executing the powershell script: D:\BuildAgent\tasks\NuGetInstaller\0.1.17\NuGetInstaller.ps1
2016-07-18T12:20:41.3220747Z D:\BuildAgent\agent\worker\tools\NuGet.exe restore "D:\BuildAgent\_work\8\s\CIBuildPSA\CIBuildPSA.sln" -NonInteractive
2016-07-18T12:20:41.6210918Z MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
2016-07-18T12:20:41.6870956Z Finishing task: NuGetInstaller
2016-07-18T12:20:41.6950960Z Starting task: Fetch the Quality Profile from SonarQube
2016-07-18T12:20:41.6970961Z Executing the powershell script: D:\BuildAgent\tasks\SonarQubePreBuild\1.0.34\SonarQubePreBuild.aps1
2016-07-18T12:20:41.8101026Z ##[debug]
2016-07-18T12:20:42.0451161Z SonarQube Scanner for MSBuild 1.1
2016-07-18T12:20:42.0461161Z Default properties file was not found at D:\BuildAgent\tasks\SonarQubePreBuild\1.0.34\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
2016-07-18T12:20:42.0471162Z Pre-processing started.
2016-07-18T12:20:42.0481162Z Preparing working directories...
2016-07-18T12:20:42.0491163Z Checking for updates...
2016-07-18T12:20:42.0511164Z ##[error]Could not find a file on the SonarQube server. Url: http://server:9081/static/csharp/SonarQube.MSBuild.Runner.Implementation.zip
2016-07-18T12:20:42.0521165Z ##[error]Failed to update the SonarQube Scanner for MSBuild binaries. Check the server url, verify that the C# plugin is correctly installed on the SonarQube server and that the SonarQube server has been restarted.
2016-07-18T12:20:42.0531165Z ##[error]Pre-processing failed. Exit code: 1
2016-07-18T12:20:42.0821182Z ##[error]Unexpected exit code received from batch file: 1
2016-07-18T12:20:42.0961190Z Finishing task: SonarQubePreBuild
2016-07-18T12:20:42.1451218Z Starting task: Copy Files to: $(build.artifactstagingdirectory)
2016-07-18T12:20:42.1541223Z Set workingFolder to default: D:\BuildAgent\tasks\CopyFiles\1.0.13
2016-07-18T12:20:42.3601341Z ##[debug]check path : D:\BuildAgent\tasks\CopyFiles\1.0.13\task.json
2016-07-18T12:20:42.3601341Z ##[debug]set resource file to: D:\BuildAgent\tasks\CopyFiles\1.0.13\task.json
2016-07-18T12:20:42.3611341Z ##[debug]system.culture=en-US
2016-07-18T12:20:42.3611341Z ##[debug]load strings from: D:\BuildAgent\tasks\CopyFiles\1.0.13\task.json
2016-07-18T12:20:42.3611341Z ##[debug]load loc strings from: D:\BuildAgent\tasks\CopyFiles\1.0.13\Strings\resources.resjson\en-US\resources.resjson
2016-07-18T12:20:42.3621342Z ##[debug]Contents=**\bin\release\**
2016-07-18T12:20:42.3621342Z ##[debug]SourceFolder=D:\BuildAgent\_work\8\s
2016-07-18T12:20:42.3621342Z ##[debug]check path : D:\BuildAgent\_work\8\s
2016-07-18T12:20:42.3631342Z ##[debug]TargetFolder=D:\BuildAgent\_work\8\a
2016-07-18T12:20:42.3631342Z ##[debug]CleanTargetFolder=false
2016-07-18T12:20:42.3631342Z ##[debug]OverWrite=false
2016-07-18T12:20:42.3631342Z ##[debug]include content pattern: **\bin\release\**
2016-07-18T12:20:42.3881357Z ##[debug]find D:\BuildAgent\_work\8\s
2016-07-18T12:20:42.3891357Z ##[debug]179 matches.
2016-07-18T12:20:42.3951361Z ##[debug]allFiles contains 128 files
2016-07-18T12:20:42.3951361Z ##[debug]Include matching D:\BuildAgent\_work\8\s\**\bin\release\**
2016-07-18T12:20:42.3991363Z ##[debug]Include matched 0 files
2016-07-18T12:20:42.4001364Z ##[debug]load strings from: D:\BuildAgent\tasks\CopyFiles\1.0.13\node_modules\vsts-task-lib\lib.json
2016-07-18T12:20:42.4011364Z ##[debug]load loc strings from: D:\BuildAgent\tasks\CopyFiles\1.0.13\node_modules\vsts-task-lib\Strings\resources.resjson\en-US\resources.resjson
2016-07-18T12:20:42.4021365Z found 0 files
2016-07-18T12:20:42.4081368Z Finishing task: CopyFiles
2016-07-18T12:20:42.4121370Z Starting task: Publish Artifact: drop
2016-07-18T12:20:42.4131371Z Set workingFolder to default: D:\BuildAgent\tasks\PublishBuildArtifacts\1.0.28
2016-07-18T12:20:42.5991477Z ##[debug]check path : D:\BuildAgent\tasks\PublishBuildArtifacts\1.0.28\task.json
2016-07-18T12:20:42.6001478Z ##[debug]set resource file to: D:\BuildAgent\tasks\PublishBuildArtifacts\1.0.28\task.json
2016-07-18T12:20:42.6001478Z ##[debug]system.culture=en-US
2016-07-18T12:20:42.6011479Z ##[debug]load strings from: D:\BuildAgent\tasks\PublishBuildArtifacts\1.0.28\task.json
2016-07-18T12:20:42.6011479Z ##[debug]load loc strings from: D:\BuildAgent\tasks\PublishBuildArtifacts\1.0.28\Strings\resources.resjson\en-US\resources.resjson
2016-07-18T12:20:42.6021479Z ##[debug]system.hosttype=build
2016-07-18T12:20:42.6021479Z ##[debug]PathtoPublish=D:\BuildAgent\_work\8\a
2016-07-18T12:20:42.6021479Z ##[debug]check path : D:\BuildAgent\_work\8\a
2016-07-18T12:20:42.6031480Z ##[debug]ArtifactName=drop
2016-07-18T12:20:42.6031480Z ##[debug]ArtifactType=Container
2016-07-18T12:20:42.6041480Z ##[debug]TargetPath=\\my\share\Main_Sonar\20160718.7
2016-07-18T12:20:42.9871699Z Max Concurrent Uploads 4, Max Creators 1
2016-07-18T12:20:43.0141715Z Found 0 files to upload.
2016-07-18T12:20:43.0171717Z Created 0 files without uploading content. Total files processed 0
2016-07-18T12:20:43.0181717Z Uploaded artifact 'D:\BuildAgent\_work\8\a' to container folder 'drop' of build 102.
2016-07-18T12:20:43.2781866Z Associated artifact 83 with build 102
2016-07-18T12:20:43.2871871Z Finishing task: PublishBuildArtifacts
2016-07-18T12:20:43.2891872Z ##[error]Task SonarQubePreBuild failed. This caused the job to fail. Look at the logs for the task for more details.
After installing SonarQube server, you need to sign in the sever as an administrator, go to the Update Center (Settings | System | Update Center), and install the SonarQube C# Plug-in.
Also, SonarQube must be restarted after installing the plugin.
You may check whether you have completed the steps above. In the following link, there is detailed guide of how to install and configure SonarQube, you can chek it:
https://github.com/SonarSource-VisualStudio/sonar-.net-documentation/blob/master/doc/installation-and-configuration.md#setup-sonarqube-server

Sonar and TFS 2013 : No ProjectInfo.xml files were found

When I run TFS 2013 with sonar I get the following error: No ProjectInfo.xml files were found. Check that the analysis targets are referenced by the MSBuild projects being built.
Message: TF270015: 'SonarQube.MSBuild.Runner.exe' returned an unexpected exit code. Expected '0'; actual '1'.
I use :
sonarqube-5.1.zip
sonar-csharp-plugin-4.0.jar
SonarQube.MSBuild.Runner-0.9.zip
sonar-runner-dist-2.4.zip
I've followed instructions found in "SonarQube Installation Guide for Existing TFS Environment.pdf".
Any help ?
Thank you.
Log :
SonarQube Analysis Summary
Analysis failed for SonarQube project "WpfApplication2", version 1.0
Product projects: 0, test projects: 0
Invalid projects: 0, skipped projects: 0, excluded projects: 0
Résumé
Debug | x86
0 erreur(s), 1 avertissement(s)
$/Essai2/WpfApplication2/WpfApplication2.sln - 0 erreur(s), 1 avertissement(s),
Afficher le fichier journal
C:\Builds\1\Essai2\WpfApplication2\src\documents\visual studio 2013\Projects\WpfApplication2\WpfApplication2.sln.metaproj : The specified solution configuration "Debug|x86" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration.
$/Essai2/WpfApplication2/WpfApplication2.sln compilé
Aucun résultat des tests
Aucun résultat de couverture du code
Autres erreurs et avertissements
2 erreur(s), 0 avertissement(s)
01:45:52: No ProjectInfo.xml files were found. Check that the analysis targets are referenced by the MSBuild projects being built.
Exception Message: TF270015: 'SonarQube.MSBuild.Runner.exe' returned an unexpected exit code. Expected '0'; actual '1'. See the build logs for more details. (type UnexpectedExitCodeException)
Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Here is the Diagnostic (I truncated the source check out part) :
Compile, Test and Publish00:00:46
Run optional script before MSBuild00:00:08
InputsEnvironmentVariables:
Enabled: True
Arguments: /key:WpfApplication2 /name:WpfApplication2 /version:1.0
FilePath: C:\sonarqube\bin\SonarQube.MSBuild.Runner.exe
OutputsResult: 0
C:\sonarqube\bin\SonarQube.MSBuild.Runner.exe /key:WpfApplication2 /name:WpfApplication2 /version:1.0
Pre-processing (3 arguments passed)
Using environment variables to determine the download directory...
Using environment variable 'TF_BUILD_BUILDDIRECTORY', value 'C:\Builds\1\Essai2\WpfApplication2'
Creating the analysis bin directory: C:\Builds\1\Essai2\WpfApplication2\sqtemp\bin
SonarQube server url: http://localhost:9000
Downloading SonarQube.MSBuild.Runner.Implementation.zip from http://localhost:9000/static/csharp/SonarQube.MSBuild.Runner.Implementation.zip to C:\Builds\1\Essai2\WpfApplication2\sqtemp\bin\SonarQube.MSBuild.Runner.Implementation.zip
Executing file C:\Builds\1\Essai2\WpfApplication2\sqtemp\bin\SonarQube.MSBuild.PreProcessor.exe
Args: "/key:WpfApplication2" "/name:WpfApplication2" "/version:1.0"
Working directory: C:\Builds\1\Essai2\WpfApplication2\sqtemp\bin
Timeout (ms):300000
Process id: 4168
01:45:11: The path to the sonar-runner.properties file was not supplied on the command line. Attempting to locate the file...
01:45:11: Located the runner properties file: C:\sonar-runner-2.4\conf\sonar-runner.properties
01:45:11: Legacy TeamBuild environment detected
01:45:11: Creating config and output folders...
01:45:11: Removing the existing directory: C:\Builds\1\Essai2\WpfApplication2\sqtemp\conf
01:45:11: Creating directory: C:\Builds\1\Essai2\WpfApplication2\sqtemp\conf
01:45:11: Removing the existing directory: C:\Builds\1\Essai2\WpfApplication2\sqtemp\out
01:45:11: Creating directory: C:\Builds\1\Essai2\WpfApplication2\sqtemp\out
Generating the FxCop ruleset...
01:45:14: Saving the config file to C:\Builds\1\Essai2\WpfApplication2\sqtemp\conf\SonarQubeAnalysisConfig.xml
Process returned exit code 0
Run MSBuild00:00:12
InputsProjectsToBuild: String[] Array
MSBuildMultiProc: True
Verbosity: Normal
ToolPlatform: Auto
Targets:
RunCodeAnalysis: AsConfigured
CommandLineArguments: /p:SkipInvalidConfigurations=true /p:Configuration=Debug /p:Platform="Any CPU"
ConfigurationsToBuild: String[] Array
OutputLocation: SingleFolder
Enabled: True
ToolVersion:
CleanBuild: True
OutDir:
RestoreNuGetPackages: True
C:\Program Files\Microsoft Team Foundation Server 12.0\Tools\nuget.exe restore "C:\Builds\1\Essai2\WpfApplication2\src\documents\visual studio 2013\Projects\WpfApplication2\WpfApplication2.sln" -NonInteractive
C:\Program Files (x86)\MSBuild\12.0\bin\amd64\MSBuild.exe /nologo /noconsolelogger "C:\Builds\1\Essai2\WpfApplication2\src\documents\visual studio 2013\Projects\WpfApplication2\WpfApplication2.sln" /nr:False /fl /flp:"logfile=C:\Builds\1\Essai2\WpfApplication2\src\documents\visual studio 2013\Projects\WpfApplication2\WpfApplication2.log;encoding=Unicode;verbosity=normal" /p:SkipInvalidConfigurations=true /p:Configuration=Debug /p:Platform="Any CPU" /m /p:OutDir="C:\Builds\1\Essai2\WpfApplication2\bin\\" /p:Configuration="Debug" /p:Platform="x86" /p:VCBuildOverride="C:\Builds\1\Essai2\WpfApplication2\src\documents\visual studio 2013\Projects\WpfApplication2\WpfApplication2.sln.x86.Debug.vsprops" /dl:WorkflowCentralLogger,"C:\Program Files\Microsoft Team Foundation Server 12.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Normal;BuildUri=vstfs:///Build/Build/52;IgnoreDuplicateProjects=False;InformationNodeId=12;TargetsNotLogged=GetNativeManifest,GetCopyToOutputDirectoryItems,GetTargetPath;LogProjectNodes=True;LogWarnings=True;TFSUrl=http://localhost:8080/tfs/DefaultCollection;"*WorkflowForwardingLogger,"C:\Program Files\Microsoft Team Foundation Server 12.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Normal;" /p:BuildId="dbda6e4d-d5bc-4eed-8b3e-6cc79e3721cc,vstfs:///Build/Build/52" /p:BuildLabel="WpfApplication2_20150615.3" /p:BuildTimestamp="Mon, 15 Jun 2015 11:44:59 GMT" /p:BuildSourceVersion="LWpfApplication2_20150615.3#$/Essai2" /p:BuildDefinition="WpfApplication2"
Run optional script after MSBuild00:00:00
InputsEnvironmentVariables:
Enabled: True
Arguments:
FilePath:
OutputsResult: 0
Run optional script before Test Runner00:00:00
InputsEnvironmentVariables:
Enabled: True
Arguments:
FilePath:
OutputsResult: 0
Run VS Test Runner00:00:00
InputsTestSpecs: BuildParameter[] Array
Enabled: False
ConfigurationsToTest: String[] Array
OutDir:
This activity was not run since its Enabled property was set to False.
Run optional script after Test Runner00:00:25
InputsEnvironmentVariables:
Enabled: True
Arguments:
FilePath: C:\sonarqube\bin\SonarQube.MSBuild.Runner.exe
OutputsResult: 0
C:\sonarqube\bin\SonarQube.MSBuild.Runner.exe
Post-processing (no arguments passed)
Using environment variables to determine the download directory...
Using environment variable 'TF_BUILD_BUILDDIRECTORY', value 'C:\Builds\1\Essai2\WpfApplication2'
Executing file C:\Builds\1\Essai2\WpfApplication2\sqtemp\bin\SonarQube.MSBuild.PostProcessor.exe
Args:
Working directory: C:\Builds\1\Essai2\WpfApplication2\sqtemp\bin
Timeout (ms):3600000
Process id: 6548
01:45:28: Legacy TeamBuild environment detected
01:45:28: Loading the SonarQube analysis config from C:\Builds\1\Essai2\WpfApplication2\sqtemp\conf\SonarQubeAnalysisConfig.xml
01:45:28: Legacy TeamBuild environment detected
01:45:28: Attempting to locate the CodeCoverage.exe tool...
01:45:28: Code coverage command line tool: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe
01:45:28: Fetching code coverage report information from TFS...
01:45:28: Connecting to TFS...
01:45:29: Fetching build information...
01:45:30: Fetch code coverage report info...
01:45:52: Operation timed out, Elapsed time (ms): 20358
01:45:52: ...done.
01:45:52: No code coverage reports were found for the current build.
01:45:52: Generating SonarQube project properties file to C:\Builds\1\Essai2\WpfApplication2\sqtemp\out\sonar-project.properties
01:45:52: No ProjectInfo.xml files were found. Check that the analysis targets are referenced by the MSBuild projects being built.
01:45:52: Writing processing summary to C:\Builds\1\Essai2\WpfApplication2\sqtemp\out\ProjectInfo.log
01:45:52: Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
01:45:52: Updating the TeamBuild summary...
Process returned exit code 1
Exception Message: TF270015: 'SonarQube.MSBuild.Runner.exe' returned an unexpected exit code. Expected '0'; actual '1'. See the build logs for more details. (type UnexpectedExitCodeException) Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Handle Exception
Troubleshooting issues with the MSBuild.Runner v0.9
The following information is provided to help troubleshooting issues with version 0.9 of the MSBuild.Runner. The behaviour may change in later versions.
Most serious configuration issues will result in warnings or errors that will appear on the Build Summary page. In cases in which there are no errors or warnings reported, check the TFS TeamBuild diagnostic output (click on "Diagnostics" link at the top of the build summary report in Visual Studio). Both the pre- and post-processor steps log quite a lot of information to help diagnose issues.
1. Check the SonarQube Analysis Summary section appears in the Build Summary Report
The section should look like this:
SonarQube Analysis Summary
Analysis failed for SonarQube project "Simple console app", version 1.0
Product projects: 4, test projects: 2
Invalid projects: 0, skipped projects: 0, excluded projects: 0
If the section does not appear on the build summary page then there are configuration issues with the build agent, build definition, or both. Read the steps below to diagnose these further.
1.1 Check the number of projects that are reported in the summary
If no projects were found then it suggests that the integration targets are not being imported and used during the build.
If all of the projects are marked as invalid, it is likely that you are building more than one configuration e.g. [release or debug] | [x86 or x64]. You should also get an error saying no ProjectInfo.xml files could be found.
You can only analyse one configuration at a time. If you want to analyze both release and debug builds, then you will need to create a separate build definition for each, using different SonarQube project ids.
The diagnostic log will contain more infomation about why a project was invalid, which is normally because the project doesn't have a guid, or the guid is not unique. The normal reason for a non-unique guid is that you are building multiple configurations e.g. release and debug.
2. Check that the pre-build step is being executed
The diagnostic output should contain output similar to the following:
Run optional script before MSBuild
C:\SonarQube\bin\SonarQube.MSBuild.Runner.exe /key:MyProject /name:"My Project" /version:1.0
Pre-processing (3 arguments passed)
If it doesn't, check that the you are correctly calling SonarQube.MSBuild.Runner.exe in the "Pre-build script" step in the build definition. An easy mistake is to put the script parameters in the wrong box by setting the "Post-build" properties instead (unhelpfully, the Post-build fields in the UI appear before the Pre-build fields).
2. Check that the post-build step is being executed
The diagnostic output should contain output similar to the following:
Run optional script after Test Runner
C:\SonarQube\bin\SonarQube.MSBuild.Runner.exe
Post-processing (no arguments passed)
If it doesn't, check that the you are correctly calling SonarQube.MSBuild.Runner.exe in the "Post-test script" step in the build definition.
3. Check the rest of the diagnostic log
If the pre- and post- build steps are being executed correctly, check the rest of the diagnostic output for any clues as to what isn't working. Pay particular attention to messages from the pre- and post-processor about the directories and files they are writing to.
4. Check the files that have been created on the build agent
The analysis process creates temporary files under the build directory under a folder called SQTemp in v0.9.
Examining the contents of the folders can help determine the stage at which the analysis is failing.
The expected folders are as follows:
bin: this folder contains the analysis targets and binaries. It is created by the SonarQube.MSBuild.Runner.exe which downloads the files from the SonarQube server. If this folder does not exist or is empty then the analysis failed at a very early stage and there should warnings or errors. Check that the C# plugin v4 is installed correctly on the SonarQube server, and that the SonarQube has been restarted since the plugin was installed.
conf: this folder is created during pre-processing and contains the settings downloaded from the SonarQube server. If there are any FxCop rules active in the SonarQube the folder should contain an FxCop ruleset.
out: this folder is populated during the MSBuild phase. It should contain one folder per project being built. It will also contain the generated sonar-project.properties file that is passed to the sonar-runner. If the folder is empty then it is possible the SonarQube.Integration.targets are not being imported correctly.
The error message "No ProjectInfo.xml files were found" will normally appear in this case. The ProjectInfo.xml files are generated by the target "WriteSonarQubeData" in the SonarQube.Integration.targets, so the next thing to check is that SonarQube.Integration.targets are being imported correctly and the expected targets are being executed.
5. Checking the SonarQube.Integration.targets are imported and called
Firstly, double-check the installation of the SonarQube.Integration.ImportBefore.targets file:
check it is in the correct folder for the version of MSBuild you are using i.e. %ProgramFiles(x86)%\MSBuild\[12.0 or 14.0]\Microsoft.Common.Targets\ImportBefore
check for typos in the folder name "ImportBefore" (should be singular, not plural)
(Thanks to Richard from BlackMarble for this tip).
If the targets are installed correctly then you will need to increase the verbosity of the MSBuild logging to diagnostic and build again so you can check the detailed MSBuild output. Unfortunately, there doesn't seem to be a simple way to increase the verbosity of the MSBuild logs when running under TeamBuild 2013. You can produce an additional log file with more detail, but you will need access to the build agent machine to pick up the log file.
To create an MSBuild log with more detailed info:
select "Queue New Build" from the BUILD menu in Visual Studio
click on the "Parameters" tab.
Expand the "2. Build" section and the "5. Advanced" sections
Set the "MSBuild arguments" property to the following:
/m:1 /fl2 /flp2:"verbosity=diagnostic"
The "/m:1" tells MSBuild not to build in parallel which can make the log easier to read. The other two parameters tell MSBuild to log to a file. See the MSBuild command line help for more info.
Click "Queue" and wait for the build to finish.
Find and open the log on the build agent. It should be called msbuild2.log and be under the source directory for your build definition.
If the SonarQube.Intergration.ImportBefore.targets are being executed, there will be a log entry saying the "SonarQubeImportBeforeInfo" target was executed. There should be some output message saying whether the file "SonarQube.Integration.targets" was located or not.
The ProjectInfo.xml files are written by the target "WriteSonarQubeProjectData". The log should show that this target has been executed, and the "WriteProjectInfoFile" task has executed. If not, the log should give an idea of why the targets were skipped.

Sonar Runner does not use properties of sonar-project.properties

I am using SonarQube Runner 2.4 at jenkins since today but the analysis fail with the message:
SonarQube Runner 2.4
Java 1.7.0_51 Oracle Corporation (64-bit)
INFO: Runner configuration file: /.jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Sonar_Runner_2.4/conf/sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "en_US", source code encoding: "ISO-8859-1" (analysis is platform dependent)
INFO: Work directory: /.jenkins/workspace/Sonar/.sonar
INFO: SonarQube Server 4.3.2
23:21:42.176 INFO - Load batch settings
23:21:42.160 INFO - User cache: /.sonar/cache
23:21:42.270 INFO - Install plugins
23:21:43.322 INFO - Install JDBC driver
23:21:43.329 INFO - Create JDBC datasource for jdbc:mysql://xxx
23:21:45.505 INFO - Initializing Hibernate
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 5.214s
Final Memory: 21M/429M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: You must define the following mandatory properties for ‚com.mypackage:MyProject: sonar.sources
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure
[BFA] Scanning build for known causes...
[BFA] Done. 0s
Notifying upstream projects of job completion
Finished: FAILURE
If I add the property "MyProject.sonar.sources=src" In the project properties in Jenkins (I use "Invoke Standalone Sonar Analysis"). I will receive the error message
ERROR: Caused by: Findbugs needs sources to be compiled. Please build project before executing sonar and check the location of compiled classes.
This means the sonar-project.properties (/.jenkins/workspace/Deploy/MyProject/sonar-project.properties) is not read or used because there are all values defined:
sonar.language=java
sonar.projectName=MyProject
sonar.projectVersion=0.1
sonar.binaries=bin
sonar.projectDescription=
sonar.projectKey=MyProjectKey
sonar.sources=src
When sonar is executed I can see the correct path to MyProject where :
-DMyProject.sonar.projectBaseDir=/.jenkins/workspace/Deploy/MyProject
Or does the name of sonar-project.properties changed?
Please build the project in the release mode. After the build happens you will get the dll's produced somewhere. you have to point to that location.

SonarQube Runner 2.4 can not find sonar.sources in sonar-project.properties even it exist

I am using SonarQube Runner 2.4 at jenkins since today but the analysis fail with the message:
SonarQube Runner 2.4
Java 1.7.0_51 Oracle Corporation (64-bit)
INFO: Runner configuration file: /.jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Sonar_Runner_2.4/conf/sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "en_US", source code encoding: "ISO-8859-1" (analysis is platform dependent)
INFO: Work directory: /.jenkins/workspace/Sonar/.sonar
INFO: SonarQube Server 4.3.2
23:21:42.176 INFO - Load batch settings
23:21:42.160 INFO - User cache: /.sonar/cache
23:21:42.270 INFO - Install plugins
23:21:43.322 INFO - Install JDBC driver
23:21:43.329 INFO - Create JDBC datasource for jdbc:mysql://xxx
23:21:45.505 INFO - Initializing Hibernate
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 5.214s
Final Memory: 21M/429M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: You must define the following mandatory properties for ‚com.mypackage:MyProject: sonar.sources
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure
[BFA] Scanning build for known causes...
[BFA] Done. 0s
Notifying upstream projects of job completion
Finished: FAILURE
But sonar-project.properties of My_Project contain sonar.sources.
sonar.language=java
sonar.projectName=My_Project
sonar.projectVersion=0.1
sonar.binaries=bin
sonar.projectDescription=
sonar.projectKey=MyProjectKey
sonar.sources=src
Where is the problem?
Greetings
Try adding "sonar.sources=." See if this works or not. Please add the log if the problem still persists.
sonar.sources and sonar.binaries path should be relative to the sonar runner home. You need to check that of the path is right as just src.

Resources