Where to find sonar-scanner code to trigger sonarcloud analysis

Hello,

We’re using SonarCloud and when I first set it up I got a code string with parameters to trigger the analysis from the sonar-scanner CLI, but I’ve lost it and can’t find it now that the codebase was analysed once.

Where can I find this long string again?

Thanks.

1 Like

Hi,

You have the documentation of the sonar-scanner CLI here if you want the parameters : https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/

Do you use a CI tool along with SonarCloud ?

Mickaël

Hi, thanks for the link, but I was already aware of it. What I don’t know is how to concatenate the parameters and how to start and end the string.

No, I just want to trigger the analysis from the CLI

As long as you are calling it from a “standard” CLI (bash, powershell,…) you have to call it like this :

.\sonar-scanner -Dparam=value -Dparam2=value2 …

Is that you wanted ?

Mickaël

Yes, thanks

Doesn’t seem to work, I get the following:

ERROR: Unrecognized option: -sonar.host.url=https://sonarcloud.io

You should add the “'D” in capital after the dash and before the property name, like -Dsonar.host.url=…

Ah right OK, thanks.