Skip to end of metadata
Go to start of metadata

This explains how to configure SonarQube plugin eclipse and IntelliJ, so that developers don't need to move away from the IDE in order to find and fix any code quality issues.

You either can do the analysis connecting to the remote Sonar server which Apache Stratos, or else run your own Sonar instance locally, configured with the same 'Quality Profile' used for remote analysis. It is advisable to analyse the code, either remotely or locally, before committing any new code, in order to maintain a high code quality of Apache Stratos.

Remote Server

Apache SonarQube server URL,

Local Server

Here we explain how to setup a local SonarQube server. Remote analysis may take time in cases where you analyze multiple projects at once. In that case other option to follow is to run the Sonar server in your local machine.

Download SonarQube Server

Configure Server
  • Unzip the and go to sonarqube-x.x/bin/<your-OS>
  • Start Sonar server:  ./ start

This will start the SonarQube server and you can access the the web console with http://localhost:9000/

Login to the console

 username: admin

 password: admin

Install plugins

Through web console install following plugins

Settings → Update Centre→ Available Plugins

    •   FindBugs (This plugin may have already installed)
    •   Checkstyle
    •   PMD

You may have to restart Sonar server after each plugin installation.

Import Quality Profile 

In order to be consistent, the same Quality Profile which is being used in remote analysis should be used for local analysis

 Verify that 520 rules are associated with the newly added profile

Note: Ideally there should be 524 rules, but 4 rules got excluded due to a Sonar issue

Linking a project for the first time

In order to analyse the project from your IDE, a corresponding project needs to be created in your local SonarQube server.

  • In command line, go to a project component which you want to run Sonar analysis,
  • $ cd stratos/components/org.apache.stratos.manager
  • $ mvn sonar:sonar

   This will run the analysis for the first time and will create a project in your local sonar server with the name of the component.


  • No labels