Quickly benefit from Sonar, an open-source Code Quality Management Platform based on many well known analysis tools like Checkstyle, PMD, Findbugs, Cobertura, ....
Once your technical project is configured in Hudson, just activate the Sonar plugin in order to analyze your source code according to the following quality axes :
- Respect of coding rules violations
- Density of documented API
- Density of duplicated Code
- Level of code coverage by Unit Tests
- Density of potential bugs
- Complexity distribution
Why using Sonar ?
- There isn't any necessary configuration for Maven project and a basic one for Ant project
- All those quality axes are displayed in one page : the project dashboard
- You can easily drill down from the measure values to the module (Maven), package and classes (source code viewer)
Sonar drives many tools including among others :
Screenshots
All projects

Project dashboard

Configuration
- Install and start the Sonar server
- Activate the Sonar plugin from the Hudson Plugin Manager
- Define a Sonar installation from the Configure System page. Some advanced parameters are used when overriding default Sonar configuration.
- Activate Sonar on jobs from the "Post-build actions" section.
- Build your project
 | We recommend to execute Sonar at the most on nightly builds. It's useless to activate it on continuous builds. |
- View your project in Sonar application (default is http://localhost:9000)
Release notes
See the roadmap.
1.0.1 (June 3rd, 2009)
- SONARPLUGINS-88 "Skip if build fails" ckeckbox is not correctly initialized
- SONARPLUGINS-100 Slightly change the order of parameters in the Maven command line to launch Sonar
1.0 (May 20th, 2009)
 | Compatible with Sonar 1.8+ and Hudson 1.306+. For older versions, please use 0.2. |
0.2
 | Compatible with Sonar versions <= 1.8. |
- SONAR-326 : manage jobs that are not built with maven2
- SONAR-325 : use the configured maven installation
0.1
Support
Please post comments and questions on the Sonar mailing-list. Issues are listed in JIRA.
Comments (7)
Mar 27
Robert Dale says:
Will this run separate from any site reports so as to not interfere with findbug...Will this run separate from any site reports so as to not interfere with findbugs,checkstyle,pmd,etc graphs already in hudson? I understand that tests may run more than once, but it would be nice to continue to have quick at-a-glance metrics and trends in hudson, then be able to click off to sonar for deeper analysis.
May 29
Freddy Mallet says:
Hi Robert, you're right and we've already got contributions from the Sonar commu...Hi Robert, you're right and we've already got contributions from the Sonar community (SONAR-852, SONAR-853, SONAR-854) so that the "Hudson Violations plugin" can automatically be fed with Sonar reports. This will be available with Sonar 1.10 (Begining of July).
May 25
Gabriel Casarini says:
Hi, we're using Hudson 1.299, Sonar 1.8 and the latest version of the Sonar plug...Hi,
we're using Hudson 1.299, Sonar 1.8 and the latest version of the Sonar plugin. Our projects are built with Ant. So far, the installation is ok (settings in Hudson, use MySQL, etc). But unfortunately, we have encountered a problem with the Sonar plugin. During the invocation we get this error:
"Cannot execute mojo: sonar. It requires a project with an existing pom.xml, but the build is not using one"
Looking at the error log (in Hudson), I have found the invocation command:
mvn.bat -e -B sonar:sonar -Dsonar.jdbc.driver=com.mysql.jdbc.Driver -Dsonar.jdbc.username=sonar -Dsonar.jdbc.password=sonar -Dsonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8 -Dsonar.host.url=http://localhost:8081/sonar -f sonar-pom.xml
Notice that "-f sonar-pom.xml" is at the END of the line, after all the -D properties.
Doing the invocation myself (through the command line) and moving -f sonar-pom.xml BEFORE the -D Java switches, solves the problem
So the problem is in the order of the parameters. Unfortunately, the invocation line is created by the plugin on the fly (using the settings configured in Hudson). And I cannot change it...
Have you identified this same issue?
Kindest regards,
Gabriel
May 29
Freddy Mallet says:
Hi Gabriel, I've created ticket SONARPLUGINS100Hi Gabriel, I've created ticket SONARPLUGINS-100. This should be fixed with version 1.1 of the Sonar Hudson plugin.
Thanks for your help,
Freddy
May 27
Edgar Miller says:
Hi there, \\ I am trying to install the plugin in Hudson 1.307, but getting alwa...Hi there,
I am trying to install the plugin in Hudson 1.307, but getting always an error while installation:
com.thoughtworks.xstream.mapper.CannotResolveClassException: hudson.plugins.sonar.SonarPublisher: hudson.plugins.sonar.SonarPublisher
Have any idea?
regards
EdgarM
P.S: I "downgraded" my hudson to 1.306 and the plugin worked immediatly.
May 29
Freddy Mallet says:
See this threadSee this thread. We can't manage to reproduce the issue.
Jun 22
Ankit Mittal says:
Hi , I am using Sonar Hudon Plugin , how should I configure the logger in Hudson...Hi , I am using Sonar Hudon Plugin , how should I configure the logger in Hudson to get logs for all level in output console , right now I can see the Sonar Logs only if any build fail. I tried initializing logs on hudson.plugin.sonar.* bu setting it in Log recorder , but I still cant see any logs