Source: Bitbucket Cloud
CI: Jenkins
Language: C++
Scanner Command Used:
& $env:SONAR_DIRECTORY/build-wrapper-win-x86/build-wrapper-win-x86-64.exe --out-dir bw-output "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe" {REDACTED}.sln /t:Rebuild `
& $env:SONAR_SCANNER_HOME/bin/sonar-scanner.bat `
-D"sonar.organization=xxxxxxxxxxxx" `
-D"sonar.projectKey=xxxxxxxxxxxxxxxxxx" `
-D"sonar.sources=." `
-D"sonar.host.url=https://sonarcloud.io" `
-D"sonar.cfamily.build-wrapper-output=bw-output" `
-D"sonar.login=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
First of all the command provided online is incorrect, it claims \ is the line continuation when in PowerShell ` is used. This was fixed on our script but incorrect in the command provided on the website. A different occurs occurs when using the .
When run through Jenkins, the following error occurs:
**17:48:23** INFO: Organization key: {REDACTED}
**17:48:24** INFO: Indexing files...
**17:48:24** INFO: Project configuration:
**17:48:25** INFO: 327 files indexed
**17:48:25** INFO: 0 files ignored because of scm ignore settings
**17:48:25** INFO: Quality profile for c: Sonar way
**17:48:25** INFO: Quality profile for cpp: Sonar way
**17:48:25** INFO: ------------- Run sensors on module {REDACTED}
**17:48:26** INFO: Load metrics repository
**17:48:26** INFO: Load metrics repository (done) | time=114ms
**17:48:38** sonar-scanner.bat : WARNING: An illegal reflective access operation has occurred
**17:48:38** At C:\Users\{REDACTED}\AppData\Local\Temp\jenkins6077034533791921998.ps1:21 char:3
**17:48:38** + & $env:SONAR_SCANNER_HOME/bin/sonar-scanner.bat `
**17:48:38** + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**17:48:38** + CategoryInfo : NotSpecified: (WARNING: An ill...on has occurred:String) [], RemoteException
**17:48:38** + FullyQualifiedErrorId : NativeCommandError
**17:48:38**
**17:48:38** Build step 'PowerShell' marked build as failure
The following link was not useful: Issue when integrating Sonarcloud with jenkins