Code Quality: SonarQube + Java + MySQL + Maven
Nowadays there is a several demand for programmers in the software industry, but in the last decade the software industry is looking for software engineers instead of programmers.
But, What is the difference between a programmer and a software engineer?
Basically the programmer only will focus on code/write the requirements provided by the analyst or the BA (Business Analyst).
On another hand the software engineer will be involved in several tasks like: requirement gathering, analyse and design, system architecture, prototyping or POC (Prof Of Concept), coding, feedback from the client, troubleshooting, deployment, application profiling, quality assurance, code quality, testing, team leading, bug tracking, etc.
So, in this post I will show you how to setup a very useful tool called SonarQube in order to manage code quality .
Open the next link and download the latest version of SonarQube (for this tutorial we will use version 6.2)
System Requirements - Documentation - Installation Instructions - Upgrade Instructions - License SonarQube 6.2 - Dev 14…www.sonarqube.org
Unzip the file downloaded and you should see a folder structure like this.
- Create a new MySQL Schema called sonar
- Edit the properties sonar.jdbc.username, sonar.jdbc.password and sonar.jdbc.url in [sonar_qube_root_folder]/conf/sonar.properties file with the next values
Note: Obviously the user and password values can be different based on your own configurations.
Launch SonarQube (it applies for windows-x86–32)
- Go to [sonar_qube_root_folder]/bin/[architecture]/StartSonar.bat
- Go to http://localhost:9090/
3. Press Login button and type the default SonarQube credentials (admin/admin)
In the next link you can refer the complete documentation to setup SonarQube with a different database.
There are two well-known engines that can be used in MySQL: MyISAM and InnoDB. MyISAM is the oldest of the two engines…docs.sonarqube.org
Integrate with Maven
Open your maven settings file(settings.xml) located in [maven_home]\conf\ and add the next information.
- Open your terminal or command line
- Go to your maven project (where the pom.xml file is located)
- mvn clean
- mvn install
- mvn sonar:sonar
Go to your local SonarQube instance in order to see the quality code report.
- Open http://localhost:9000
- Type the default admin credentials (admin/admin)
- Feel free to play with the UI in order to discover how useful is this tool :)
Use the “Rules” tab in order to manage your quality code rules.
Here the complete SonarQube documentation
SonarQube® software (previously called Sonar) is an open source quality management platform, dedicated to continuously…docs.sonarqube.org
That’s all folks, if you have any feedback or question feel free to share your thoughts.