Usually in any of the project, code quality plays an important role not only in the performance of your site as well as to detect bugs, code smells and security vulnerabilities. In this article I am going to discuss how we can set up sonar on our local instance to get all the issues fixed up before we merge our code.
Follow the below steps to integrate Sonar Qube Server with Code Branch :
1) Download Sonar Qube version 7.7 https://www.sonarqube.org/downloads/ ( Version compatible with Java 8)
2) Unzip the package, go inside the folder \bin\windows-x86-64 (Windows), and run StartSonar.bat.
3) Once up Sonar will be running on Port 9000. (default port)
4) Now go the pom.xml of core branch of your project and add the following changes:
5) Now run mvn clean install on the core branch and check the sonar , you will be able to see all the changes of Sonar.
Note 😆 Do not commit changes on point 4. If don’t want changes in pom.xml, run command mvn sonar:sonar
Additionally download and install sonar lint eclipse plugin to have inbuilt code issues identified. This will give additional help to identify the quality issues upfront.