Integrate Sonar in Jenkins

Posted By : Ankit Gupta | 11-Dec-2014

Jenkins tool is used for auto build,deployment and sonar is a good tool to manage code quality.


Here I am going to explain how we can integrate sonar with jenkins auto build process.


Downlaod and Install sonarquebe


To setup sonar you can find details from here


Sonar can process your project code by two ways :
1. Sonarrunner
2. Maven


Here we will use maven for project code scanning.

Install mvn and your project should have proper pom.xml file.


Add following properties in pom.xml



Sonar.sources are directories which conatins your source code.

Now you have to setup a profile in mvn setting xml.

Go to settings.xml,in linux system it is in /usr/share/maven/conf directory.


Now add a profile in settings.xml



You have to run mysql server and set up a database for sonar reports storage,Update database,username etc. in profile.

Now maven is ready to work with sonar.

Add sonar plugin in jenkins and add a PostBuildAction in your jenkins project.

Start the sonar server and build from jenkins,you will get sonar reports.



About Author

Author Image
Ankit Gupta

Ankit is a lead java developer well experienced in development of web and enterprise level applications. He has good exposure to enterprise frameworks like Drools , Opta-planner , jBilling and graph databases like Neo4J etc.

Request for Proposal

Name is required

Comment is required

Sending message..