Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

How to setup SonarQube

1 min read

Java icon

This article shows you how to setup the excellent free code quality tool SonarQube.

There are many different ways to set up SonarQube, depending what language(s) you program in and what tools you use. As an example, I’ll use SonarScanner for Maven and SonarJava to analyze the code quality of our BuildVu Microservice Example project.

To keep things simple, I’ll also be using the embedded database for storing reports. You’re strongly advised to use the embedded database for evaluation purposes only – it doesn’t scale, there’s no way to export data out into other database engines and it’ll be wiped every time you upgrade SonarQube. You can find tutorials on setting up a separate database here.

With that out of the way, getting started is easy:

    1. Download the latest version of SonarQube (7.0 was the latest version at the time of writing).
    2. When that’s finished downloading, unzip SonarQube into the directory you want to install it in. For example, I’ll be using C:/sonarqube.
    3. Open up a terminal / command line window, then start up the SonarQube server using the command:
      Windows: C:\sonarqube\bin\windows-x86-xx\StartSonar.bat (Don’t forget to change ‘xx’ to 32 or 64)
      Mac / Linux: /path/to/sonarqube/bin/[OS]/sonar.sh console

      I like to save this command in a script so in the future I can quickly start up the server.
    4. Once the server has started, open up your browser and go to http://localhost:9000. You can login using the default System Admin credentials (admin / admin).
    5. Skip the on-screen tutorial – you can always go back and do it at a later date if you want to (It can be found in the ‘Help’ section). As we haven’t actually scanned any projects yet, you should see an empty screen.
    6. Modify your Maven settings.xml file to enable SonarQube for Maven.
    7. Finally, open up a command line / terminal window in the base directory of your Maven project and run the command mvn clean verify sonar:sonar to scan your project. If you go back to the Project Overview page from earlier and refresh the page, you should now see your project appear!



Can we help you to solve any of these problems?

IDRsolutions has been helping companies to solve these problems since 1999.

Convert PDF to HTML5 or SVG with BuildVuConvert PDF to HTML5 or SVGConvert AcroForms and XFA to HTML5 with FormVuConvert PDF forms to HTML5
Java Image SDK for working with Image files with JDeliJava SDK for Image files JPedal Java PDF SDK for working with PDF filesJava SDK for PDF files
Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Leave a Reply

Your email address will not be published. Required fields are marked *

IDRsolutions Ltd 2020. All rights reserved.