Sonnar-scanner: locally - Error: Could not find or load main class org.sonarsource.scanner.cli.Main

  • sonarqube 9.3.0.51899 and sonar-scanner-cli 4.6.2.2472

  • Java SE Development Kit 17.0.3.0

  • I am trying to launch sonar scanner for the 1st time locally. I followed the tutorial and launched this command:

sonar-scanner.bat -D"sonar.projectKey=test" -D"sonar.sources=."
-D"sonar.host.url=http://localhost:9000" -D"sonar.login=**********"

I am facing this error:

Error: Could not find or load main class org.sonarsource.scanner.cli.Main
Caused by: java.lang.ClassNotFoundException: org.sonarsource.scanner.cli.Main

I want to test locally before implementing the scan on an Azure devops pipeline.
Thank you in advance for your help!

I solved the issue. I was not using the correct scanner. I downloaded it from here: Index of /Distribution/sonar-scanner-cli

And now it is working.

1 Like

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