Sonarqube + MAMP

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) » SonarQube from zip-file (developer edition), sonar-scanner, no plugins
  • what are you trying to achieve » scan a simple WordPress installation for evaluation purpose
  • what have you tried so far to achieve this » I installed sonarqube from the zip-file to my mac. I can log in to the console but I got stuck with the sonar scanner. I have a MAMP where I have simple WordPress installation which I would like to scan. Where do I have to put the scanner and what needs to be done to connect the Sonar-server to the WP installation?

Hello Jochen,

As you maybe understood it there are 2 components to the SonarQube ecosystem, the server and the scanner(s). They typically run on 2 different machines, but for small tests they can be on the same machine (your MAMP machine is OK)

  • The server is “SonarQube”. You must have it installed on some machine of some kind. Unless you have changed the port by configuration, SonarQube is running on port 9000.
    So first verify that your SonarQube is running by checking there’s a web app responding what invoking http://<nameOrIPoftheMachine>:9000.
    Log in and change the password of user admin
  • If that works, then you can scan.
    On the machine where you WP code is, install (ie download and unzip) the scanner, for instance C:\tools\scanner (or /home/jochen/scanner if you’re on Linux).

Once done, change to the root directory of your WordPress installation (all the source code that you want to scan should be under that root directory (of course possibly under any level of subdirectory)
At this root create a sonar-project.properties file and follow the instructions at SonarScanner | SonarQube Docs

Then (depending on whether you’re on Linux or Windows) simply run sonar-scanner.bat or

C:\tools\scanner\sonar-scanner-4.5.0.2216...\sonar-scanner.bat -Dsonar.host.url=http://<nameOrIP>:9000 -Dsonar.login=admin -Dsonar.password=<yourAdminPassword>
or
/home/jochen/scanner/sonar-scanner-4.5.0.2216.../sonar-scanner  -Dsonar.host.url=http://<nameOrIP>:9000 -Dsonar.login=admin -Dsonar.password=<yourAdminPassword>

Hope this helps.

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