Running Sonar from command line without a SonarQube server
13,033
If you want to get the metrics on your code, then there's no other choice than installing a SonarQube server and indeed run an analysis using a SonarQube scanner.
By the way, installing a SQ server for such a simple use case is as simple as extracting the binaries from the ZIP archive and double-click on the sonar.sh or sonar.bat scripts. See "Get Started in Two Minutes" documentation page.
Author by
Edmondo
Updated on June 17, 2022Comments
-
Edmondo almost 2 years
I need to perform some static analysis of java classes from command line To extract basic metrics and I was thinking I could use sonar-cli, but that required a fully working SonarQube.
How can I perform those inspections?
-
deamon almost 7 yearsAnother option would be to use the SonarQube Docker container.
-
Black Frog about 6 yearsI went the SonarQube docker container route. Took about 30 min to get it up and running.
-
lllllllllllll almost 4 yearsHello! Thank you for the information. I am thinking to purchase SonarQube for our usage. Basically we have quite a large number of C code (small programs; within 200 LOC) and I want to quantify each C code regarding complexity, code smells, etc. Can SQ be launched via command line? Or I will have to use mouse/browser to do all the tasks which seem quite tedious?
-
chipiik about 3 yearsDocker way: run
docker run -d --name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 sonarqube:latest
go tolocalhost:9000
in browser login with admin:admin and go to My Account -> Security -> Tokens and generate new one use it in your build - e.g.: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar -Dsonar.login=...