Analysis fails with 'task' error


I am new to Sonar and I am facing a similar issue while executing the Sonar scanner. I am trying to use Jenkins with Sonar Cloud(instead of SonarQube). Although this seems to be a bit rare I think this should work based on the demo given at CICD for Automation Testers - 13.5. SonarQube SonarCloud and Jenkins Integration for code scanning - YouTube

C:\Program Files\Git\bin\git.exe rev-list --no-walk b7aa17ee3464ed827b8c8bd3046331a45bd87b9c # timeout=10
[TestMvcWebApp] $ D:\Jenkins\sonar-scanner-msbuild-\sonar-scanner-\bin\sonar-scanner.bat SonarCloud ******** ‘-DSonarScanner.MSBuild.exe=end /d:sonar.login=“9a7b9775f45a0d88b8ae1588c59ba1b083ab87c5”’ ‘-DMSBuild.exe=“D:JenkinsWorkspaceTestMvcWebAppTestMvcWebAppTestMvcWebApp.sln” /t:Rebuild’ -Dsonar.projectBaseDir=D:\Jenkins\Workspace\TestMvcWebApp
INFO: Scanner configuration file: D:\Jenkins\sonar-scanner-msbuild-\sonar-scanner-\bin…\conf\
INFO: Project root configuration file: NONE
INFO: SonarScanner
INFO: Java 11.0.12 Oracle Corporation (64-bit)
INFO: Windows Server 2016 10.0 amd64
INFO: User cache: C:\WINDOWS\system32\config\systemprofile.sonar\cache
INFO: Scanner configuration file: D:\Jenkins\sonar-scanner-msbuild-\sonar-scanner-\bin…\conf\
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarCloud
INFO: Load global settings
INFO: Load global settings (done) | time=782ms
INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu
INFO: User cache: C:\WINDOWS\system32\config\systemprofile.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=188ms
INFO: Load/download plugins (done) | time=484ms
INFO: Loaded core extensions: developer-scanner
INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 3.937s
INFO: Final Memory: 5M/24M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: Tasks support was removed in SonarQube 7.6.
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeed?
ERROR: SonarQube scanner exited with non-zero code: 1
Finished: FAILURE

Also, I am finding it difficult to enable the full debug logging on SonarScanner.
Please find the below screen dump of the Sonar scanner parameters, please suggest how to enable the debug logging to get detailed error information using “-X” switch?

Thank you in advance!!

Hey there.

If you are analyzing a .NET project, you won’t be able to use the Execute SonarQube Scanner step in Jenkins. Please take a look at the documentation on the SonarScanner for Jenkins > Analyzing a .NET solution.

Thank you for your response Colin, I did set up my Jenkins job based on the instructions provided by you.

I see a different error this time, but could not get the root cause of the issue.
I am doing this setup as a POC and we are planning to buy the subscription once I am able to succeed in this POC. Please assist.

Running as SYSTEM Building in workspace D:\Jenkins\Workspace\TestMvcWebApp The recommended git tool is: NONE using credential jenkins > C:\Program Files\Git\bin\git.exe rev-parse --resolve-git-dir D:\Jenkins\Workspace\TestMvcWebApp.git # timeout=10 Fetching changes from the remote Git repository > C:\Program Files\Git\bin\git.exe config remote.origin.url # timeout=10 Fetching upstream changes from > C:\Program Files\Git\bin\git.exe --version # timeout=10 > git --version # ‘git version’ using GIT_SSH to set credentials > C:\Program Files\Git\bin\git.exe fetch --tags --force --progress – +refs/heads/:refs/remotes/origin/ # timeout=10 > C:\Program Files\Git\bin\git.exe rev-parse “refs/remotes/origin/master^{commit}” # timeout=10 Checking out Revision ***** (refs/remotes/origin/master) > C:\Program Files\Git\bin\git.exe config core.sparsecheckout # timeout=10 > C:\Program Files\Git\bin\git.exe checkout -f ***** # timeout=10 Commit message: “Test checkin 5” > C:\Program Files\Git\bin\git.exe rev-list --no-walk ***** # timeout=10 [TestMvcWebApp] $ D:\Jenkins\sonar-scanner-msbuild-\SonarScanner.MSBuild.exe begin /k:phanirajraichooti_testmvcwebapp /n:phanirajraichooti_testmvcwebapp /v: / ******** / /d:sonar.login=***** SonarScanner for MSBuild 5.3.2 Using the .NET Framework version of the Scanner for MSBuild A value has already been supplied for this property. Key:, existing value: A value has already been supplied for this property. Key: sonar.login=*****, existing value: ***** Default properties file was found at D:\Jenkins\sonar-scanner-msbuild-\SonarQube.Analysis.xml Loading analysis properties from D:\Jenkins\sonar-scanner-msbuild-\SonarQube.Analysis.xml ERROR: Execution of SonarScanner for MSBuild failed (exit code 1) Finished: FAILURE

Hey there.

It looks like you have already defined a SonarQube server under Manage Jenkins > Configure System and have selected Prepare SonarScanner environment in your Jenkins job. Is that correct?

This would put any configuration related to SonarCloud at odds with this configuration, hence the errors you’re receiving about parameters being defined twice.

You should either define SonarCloud as a SonarQube server or deselect Prepare SonarScanner environment in your job. Please take care to also pass your organization (/o:my-org-key)

@PhanirajRaichooti I’ve also temporarily unlisted this thread as you included user tokens in your logs/screenshots. You should consider these tokens compromised and remove them at the earliest.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.