SonarScanner - post - processing fail - sonarqube

dotnet sonarscanner end /d:sonar.login="my-token"
SonarScanner for MSBuild 5.8
Using the .NET Core version of the Scanner for MSBuild
Post-processing started.
Calling the SonarScanner CLI...
Files\Common was unexpected at this time.
The SonarScanner did not complete successfully
Post-processing failed. Exit code: 1
Help with this error while running sonnarscannar on a project.
New to Sonarqube
I believe files/common has to do something with the environament variable , but not sure.

Related

dotnet core sonarscanner not accepting arguments

I'm really not sure what's going on here.
I've got 2 issues.
SonarScanner is not accepting arguments that it tells me I can use
SonarScanner is not recognising my properties file.
What I did:
First I installed the scanner dotnet tool install --global dotnet-sonarscanner
Then I tried to run dotnet sonarscanner begin /key:"mykey" /s:"./sonar-project.properties" which gave me the following error message:
SonarScanner for MSBuild 4.6
Using the .NET Core version of the Scanner for MSBuild
Loading analysis properties from path\sonar-project.properties
Unable to read the SonarQube analysis settings file 'path\sonar-project.properties'. Please fix the content of this file.
Not sure why that is because I copied my file from here.
I then do dotnet scanner being /key:"mykey" /? and it tells me I can use /d:sonar.verbose=true. I immediatey try this command dotnet sonarscanner being /key:"mykey" /d:sonar.verbose=true and am met with this error message.
22:39:19.402 22:39:19.399 Unrecognized command line argument: being
22:39:19.403 22:39:19.4 Unrecognized command line argument: d:sonar.verbose=true
22:39:19.404 Expecting at least the following command line argument:
- SonarQube project key
When connecting to a SonarQube server earlier than version 6.1, the following command line arguments are also required:
- SonarQube project name
- SonarQube project version
The full path to a settings file can also be supplied. If it is not supplied, the exe will attempt to locate a default settings file in the same directory as the SonarQube Scanner for MSBuild.
Use '/?' or '/h' to see the help message.
22:39:19.405 Pre-processing failed. Exit code: 1
I also try dotnet sonarscanner begin /key:"mykey" /d:sonar.host.url="https://sonar.qube" but it's the same thing, it cannot recognise the argument.
Any ideas are welcome.
My sonar-project.properties
sonar.login=token
sonar.host=https://sonar.qube
sonar.projectKey=mykey
sonar.projectName=mykey
sonar.sourceEncoding=UTF-8
You have to change the '/k' for '-k'
dotnet sonarscanner begin -k:"proj_key" -d:sonar.host.url="http://myurl"
If your problem still exists, can you share the properties file? I think you have the Java project file, and not the MSBuild file (which is an XML file, see: https://docs.sonarqube.org/display/SCAN/Additional+Analysis+Parameters).
<?xml version="1.0" encoding="utf-8" ?>
<SonarQubeAnalysisProperties
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">
<Property Name="sonar.verbose">true</Property>
</SonarQubeAnalysisProperties>
The example you link towards, is showing Java code and settings.
In the second issue you have, there is a typo:
dotnet sonarscanner being /key:"mykey" /d:sonar.verbose=true
should be
dotnet sonarscanner begin /key:"mykey" /d:sonar.verbose=true
Although i expect there was a second typo for the verbosity, looking at your console output. So, your command does not seem to reflect the output there.
For the final example you give, sonar is complaining about the URL, but other than that, the command line arguments are correct and working on my machine.

Missing coverage results for Dotcover in Sonarqube

I am able to generate the HTML reports with the help of DotCover and passing the same to Sonarqube using "/d:sonar.cs.dotcover.reportsPaths=.\dotCover\dotCoverResults.html" (dotcover html has coverage data in it). In Sonar log I do not see any error message but Sonar dashboard shows no coverage; it is blank. Similar configuration for another application is working perfectly fine in other application but not in this. Blow is the configuration used in Jenkins for this.
Sonarqube version: 4.5.7
MSBuild SonarQube Runner: 2.0
C#: 5.2
dotnet restore --configfile .\.nuget\NuGet.Config
MSBuild myApplication.sln /t:Clean /t:Rebuild /p:Configuration=Debug /p:Platform=x64
nunit3-console.exe test\UnitTests\bin\Debug\net461\UnitTests.dll --result=nunit-test-results.xml;format=nunit2 --labels=On
dotCover.exe analyse .\dotCover\coverageDebug.xml
Any help is greatly appreciated.

SonarQube Scanner for MSBuild doesn't run

I am using Jenkins to run SonarQube for my .Net project(C#).
Visual Studio:2015
MsBuils: 14
Jenkins on Linux (1.624)
SonarServer on Linux (Sonar Version 6.0)
Job Config:
SonarQube Scanner for MsBuilds- Begin analysis
Project key:
Project Name:
Proj Version:
Build a Visual Studio Project or Solution using MSBuild:
MsBuild Version : MsBuild 4.6
MsBuild File: CI.Sln
Command Line Arguments: /p:Configuration=Release /target:Build
SonarQube Scanner for MSBuild- End Analysis
I can generate report for Visual Studio 2015 and post to Sonar Server but when i try to run in Jenkins job its doesn't work.
Error:
ERROR: JAVA_HOME exists but does not point to a valid Java home folder. No "\bin\java.exe" file can be found there.
The SonarQube Scanner did not complete successfully
08:42:40.676 Creating a summary markdown file...
Post-processing failed. Exit code: 1
ERROR: Execution of SonarQube Scanner for MSBuild failed (exit code 1)
I have Windows Server as an agent and out put of Microsoft Windows [Version 6.2.9200]
C:\Windows\System32>echo %JAVA_HOME%
C:\Program Files\Java\jre8
Java Home Variable Path:C:\Program Files\Java\jre8
Please let me know how would I make jenkins job work.
This was a rookie mistake.
This was an issue related to JDK, as i installed JRE but not JDK. I have installed JDK and add the path to Jenkins master and Jenkins job. Ran the job and horraaayyyy, Its working now.

No ProjectInfo.xml files were found

i am using visual studio 2015 and tfs for build the project,
I started the build but got stuck with the error described below,
2016-03-17T09:38:15.2135195Z ##[error]No ProjectInfo.xml files were found. Possible causes:
2016-03-17T09:38:15.2135195Z ##[error]1. The project has not been built - the end step was called right after the begin step, without a build step in between
2016-03-17T09:38:15.2135195Z ##[error]2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 12.0 upwards are supported
2016-03-17T09:38:15.2135195Z ##[error]3. The build step has been launched from a different working folder
2016-03-17T09:38:15.2135195Z Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
2016-03-17T09:38:15.2135195Z 15:08:15.15 Creating a summary markdown file...
2016-03-17T09:38:15.2135195Z ##[error]Post-processing failed. Exit code: 1
2016-03-17T09:38:15.2135195Z ##[error]Unexpected exit code received from batch file: 1
Can any one help me in this?
Assuming you are using TFS2015 vNext build, and you are trying to add build tasks below to execute a SonarQube analysis:
· SonarQube for MSBuild – Begin Analysis
· SonarQube for MSBuild – End Analysis
From your error log, you need to make sure the End Analysis task should be used to create a step that is executed after the “Visual Studio Build” task step. Review blog Build Tasks for SonarQube Analysis get more information of how to use SonarQube analysis tasks.

Configuring TFS 2013 has build issues with SonarQube

I have configured SonarQube to work with my TFS 2013. I followed the steps as mentioned in the setup doc. When i try to give a build from TFS online or Visual Studio, I am able to successfully complete the steps before Finish the analysis and upload the results to SonarQube.
I get the error No ProjectInfo.xml files were found. Check that the analysis targets are referenced by the MSBuild projects being built.
I am unable to figure out what might me causing the issue. I checked one of the links : No ProjectInfo.xml files were found error from command prompt using MSBuild SonarQube Runner v1.0 which speaks about the command prompt. Can someone point out where the issue is?
Below is the error log:
2015-09-12T11:44:10.9194896Z Output directory: C:\a\6fb08ad4\.sonarqube\out
2015-09-12T11:44:10.9194896Z Config file: C:\a\6fb08ad4\.sonarqube\out
2015-09-12T11:44:10.9204886Z 11:44:10 AM Loading the SonarQube analysis config from C:\a\6fb08ad4\.sonarqube\conf\SonarQubeAnalysisConfig.xml
2015-09-12T11:44:10.9204886Z 11:44:10 AM Attempting to locate the CodeCoverage.exe tool...
2015-09-12T11:44:11.3231261Z 11:44:11 AM Multiple versions of VS are installed: 11, 12, 14
2015-09-12T11:44:11.3240831Z 11:44:11 AM Code coverage command line tool: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe
2015-09-12T11:44:11.3240831Z 11:44:11 AM Fetching code coverage report information from TFS...
2015-09-12T11:44:11.3250829Z 11:44:11 AM Attempting to locate a test results (.trx) file...
2015-09-12T11:44:11.3250829Z 11:44:11 AM No test results files found
2015-09-12T11:44:11.3260828Z 11:44:11 AM Generating SonarQube project properties file to C:\a\6fb08ad4\.sonarqube\out\sonar-project.properties
2015-09-12T11:44:11.3270789Z ##[error]11:44:11 AM No ProjectInfo.xml files were found. Check that the analysis targets are referenced by the MSBuild projects being built.
2015-09-12T11:44:11.3270789Z 11:44:11 AM Writing processing summary to C:\a\6fb08ad4\.sonarqube\out\ProjectInfo.log
2015-09-12T11:44:11.3270789Z 11:44:11 AM Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
2015-09-12T11:44:11.3280797Z 11:44:11 AM Creating a summary markdown file...
2015-09-12T11:44:11.3280797Z Process returned exit code 1
2015-09-12T11:44:11.3290776Z ##[error]Post-processing failed. Exit code: 1
2015-09-12T11:44:11.5740896Z ##[error]Unexpected exit code received from batch file: 1
2015-09-12T11:44:11.5790878Z ##[debug]summaryMdPath = C:\a\6fb08ad4\.sonarqube\out\summary.md
2015-09-12T11:44:11.5820880Z ##[debug]Uploading the summary.md file
Thanks!

Resources