Sonarqube Analysis for Java Maven Project

SonarQube (formerly Sonar) is an open-source platform developed by SonarSource for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs.

We will use the sonarqube docker image to run the sonarqube locally. Afterwards we will run the analysis on local maven java project.

Pull the sonarqube from docker hub

docker pull sonarqube:lts-community

Run sonarqube image locally

You can run the sonarqube with following command. It will run at port 9000

docker run -d –name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 sonarqube:lts-community

You can check at http://localhost:9000

Username: admin / Password: admin

Create Project in Sonarqube

Sonarqube Login

Use admin as username and admin as password.

Update Password

After login it will ask to update the password. Update the password.

Create Project

Manual project creation

Create Test project

Create Test token

Run in maven java project

You can run the maven command to run the analysis for project. Once the analysis is completed it will reflect in the sonarqube.

Similar Posts

  • |

    OWASP Vulnerability Checks With Maven

    The Open Web Application Security Project (OWASP) is a nonprofit foundation that works to improve the security of software. OWASP issues and maintains several recommendations regarding how to write secure code. One of the projects OWASP runs is the OWASP Dependency-Check. Lets integrate OWASP Dependency-Check in your Java/Maven project. Here’s the configuration I’m using in…

  • Spring Boot – JaCoCo Integration

    JaCoCo (Java Code Coverage) is a popular open-source toolkit for measuring and reporting code coverage in Java projects. When integrated with Spring Boot, it helps ensure your tests are effectively covering your application logic, improving reliability and maintainability. What is JaCoCo? JaCoCo is a free Java code coverage library distributed under the Eclipse Public License….