Sonar at the Haus
If you’ve been following the twitter stream then you’d know we’ve been setting up a Sonar instance at Codehaus.
Sonar is a “code quality management platform” – it draws together a variety of code quality metrics into a consolidated portal.
Sonar enables you to collect, analyze and report metrics on source code. Sonar not only offers consolidated reporting on and across projects throughout time, but it becomes the central place to manage code quality.
At present this is only accessible to projects building on the Bamboo server (Hudson will be established soon).
Our friends at SonarSource are managing the Sonar instance for us; but you should still raise all service requests through our normal channels – we will delegate and monitor the requests over to SonarSource.
Sonar Reports
(the bottom two images are the maven images shown below – ignore them; my Wordpress-fu is too weak and I’m too lazy to manually script only the images I want at the moment)
Accessing Sonar
Head on over to the Codehaus Sonar at http://sonar.ci.codehaus.org/
Getting Started
To manage the quality of your project with Sonar, create a new plan in bamboo, fill plan details and source repository tabs.
Refer to Analyzing Java Projects section to setup an analysis, but here is some guidance : on the builder tab, choose maven as a builder in all cases.
If your project is a maven project use the following goal to run the analysis:
clean install sonar:sonar -Dmaven.test.failure.ignore=true

If your project is a non-maven, you should create a small pom.xml file as described here. Then use the goal “sonar:sonar” to run the analysis :

Save the plan and run it.
Go to http://sonar.ci.codehaus.org/ to see the result of the analysis.
FAQ
How can I get assistance in running a Sonar analysis on my project ?
Please create a ticket in Jira, using Sonar as a component.
Who can I ask questions about Sonar ?
You can ask questions on the user mailing list.
How can I use my own quality rules (profiles) and setup alerts on my project ?
At present this capability can only be managed by our Sonar administrator.
Please create a ticket in Jira, using Sonar as a component.
Where do I find more information about Sonar ?
- Sonar web site : http://sonar.codehaus.org
- Sonar wiki : http://docs.codehaus.org/display/SONAR/Documentation
- Sonar plugin library : http://docs.codehaus.org/display/SONAR/Sonar+Plugin+Library/





It’s great, thanks !
Just a question, why adding -Dmaven.test.failure.ignore=true in the maven goal ?
If it is necessarily, why not also adding maven.test.error.ignore=true
A lot of this article was written by the SonarSource guys.
I imagine the ignoring of test failure is important because it lets the Maven build continue and write Sonar output even if there is a failure. It’s potentially better to include both -Dmaven.test.error.ignore=true and -Dmaven.test.failure.ignore=true – to ensure it completes!
If not specified, maven will fail the build on test errors, before doing sonar:sonar, which is not desired – sonar will tell you which tests failed/error.