What is SONAR ?
SONAR is code reviewing tool. SONAR needs to be integrated with Hudson so that whenever someone check-in code, then it will be reviewed by SONAR before making a build. Hudson provides a plugin for SONAR and we need maven installed and configured with Hudson for this.
How to configure SONAR to work with Hudson ?
Below are the steps to configure SONAR & Hudson Integration:
Step 1: Download, install and start the Sonar Server.
Download the latest Sonar release from http://dist.sonar.codehaus.org/sonarqube-4.0.zip
Unzip the distribution. Based on your platform, run the batch file or the shell script from within the bin folder. Open a web browser and browse to http://localhost:9000. The default login and password is admin/admin.
Step 2: Install and Configure Sonar plugin on Hudson.
Open your Hudson dashboard http://IP:port. Click on Manage Hudson – Manage Plugins. Click now on the Available tab, you should see the Hudson Sonar Plugin. Check this plugin and click on the Install button at the far right hand corner. Restart Hudson and you should be able to see the plugin in the Installed tab as shown below:
Next, configure the Sonar plugin from within Manage Hudson -> Configure System and Change all required parameters
Step 3: Configure your Hudson Job
In order to activate Sonar on a project, click on Configure, and within the Post-build Actions, check Sonar and you should see the following properties. Fill those properties and Save this configuration.
Step 4: Build your project
Even though you don’t require Maven to be used as a build tool for your project, Sonar does still require Maven to run. Force a build on your Job on the Hudson dashboard. If Maven is installed, you should be able to see the following output in the Console Output on Hudson dashboard.
Step 5: Browse to Sonar Dashboard
Once the build succeeds in the last step, browse to http://localhost:9000(change port and localhost as per your environments that you have configured). And you should be able to see the Sonar Dashboard.