Sonar-scanner cannot run on windows with gitlab runner

Must-share information (formatted with Markdown):
Sonarqube: 8.4.2 (Developer edition)
Sonarscanner:4.5.0.2216
Language: C

I am trying to run:
$ sonar-scanner -Dsonar.login= -Dsonar.host.url= -X

On windows cmd line it works fine and uploads the results.
But On windows powershell and on gitlab windows runner, I get the below error:
ERROR: Unrecognized option: .login=
usage: sonar-scanner [options]
Options:
INFO: -D,–define Define property
INFO: -h,–help Display help information
INFO: -v,–version Display version information
INFO: -X,–debug Produce execution debug output

Any idea how to solve this issue?

Hey there.

Can you show how exactly you’re executing the scanner in the context of Powershell/the Gitlab runner? In powershell, are you executing the exact same command as on the windows command line?

Hi
I am executing as i said in the message:
$ sonar-scanner -Dsonar.login=xxx -Dsonar.host.url=xxx -X

I found out the problem. Its the syntax. On powershell I should run as below arguments with double quotes
$ sonar-scanner -D"sonar.login=xxx" -D"sonar.host.url=xxx" -X

2 Likes

Thanks for the update.

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