A new Hudson plugin for a closer integration with Sonar

Continuous integration (CI) has become a centerpiece of software development lifecycle. Since Sonar is implemented as a maven plugin, it can be easily integrated with any CI engine : the engine acts as the scheduler for Sonar’s daily runs. You can even imagine to use the well known but a bit outdated cron scheduler to launch the maven goal “mvn org.codehaus.sonar:sonar-maven-plugin:1.4.2:sonar” on each project you want to analyse.

At this point in time, you are probably wondering : ok, but why would I need a plugin to integrate Sonar with Hudson, the very popular, open source and easy to use CI engine ? Is it possible to get an even more seamless integration ?

In fact, when you face a real enterprise context, you need to configure your setting.xml file by hand on your integration machine and copy/paste the Sonar maven goal for each project under control : 10, 50, 100, 200 times … Life will be easier if you can :

  • Prevent edition of the setting.xml file and directly edit and view the Sonar configuration from Hudson
  • Define the Sonar maven goal only once and use it as often as often as you want

We’ve developed a Hudson plugin to provide those two missing features. All configuration is done online and is shared across projects, you can enable/disable Sonar analysis in one click for all your projects. Obviously, you still can override Sonar parameters at the project level. Imagine for instance, on a given project you don’t want to import and display source code through Sonar interface for security reason (SONAR-306).

That was the first step on planet Hudson and we wanted to go beyond. There is an unknown but yet useful Sonar functionality which allows you to analyze any java projects even if they don’t use Maven (perhaps you’re still using Ant or don’t use a build framework at all). Nevertheless, in that case you need to write by hands a short pom.xml file to provide to Sonar several mandatory parameters. This last tedious step has gone with version 0.2 of the plugin.You just need to fill those basic parameters in the Hudson job configuration and quality analysis can start. If you’re a code audit consultant and you need to quickly and efficiency analyze your customer’s sources : just tell Sonar/Hudson couple where is the source director.
Want to give it a try : just install the sonar plugin from the Hudson management console. And… don’t forget to install Hudson and Sonar before :-)

© 2008-2016, SonarSource S.A, Switzerland. All content is copyright protected. SONARQUBE, SONARLINT and SONARSOURCE are
trademarks of SonarSource SA. All other trademarks and copyrights are the property of their respective owners. All rights are expressly reserved.