Sonar plugin

Plugin Information

Plugin ID sonar
Latest Release 1.1
Latest Release Date Aug 01, 2009
Changes in Latest Release via Fisheye
Maintainer(s) n/a (java.net id: simonbrandhof)
Issue Tracking Open Issues

Quickly benefit from Sonar, an open-source Code Quality Management Platform based on many well known analysis tools like Checkstyle, PMD, Findbugs, Cobertura, ....
!sonar-logo.png! 

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 use 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

  1. Install and start the Sonar server
  2. Activate the Sonar plugin from the Hudson Plugin Manager
  3. Define a Sonar installation from the Configure System page. Some advanced parameters are used when overriding default Sonar configuration.
  4. Activate Sonar on jobs from the "Post-build actions" section.
  5. Build your project
    We recommend to execute Sonar at the most on nightly builds. It's useless to activate it on continuous builds.
  6. View your project in Sonar application (default is http://localhost:9000)

Compatibility matrix


Plugin 1.0
Plugin 1.1
Sonar
1.8+
1.8+
Hudson
1.306+ 1.317+

Support

Please post comments and questions on the Sonar mailing-list. Issues are listed in JIRA.

Release notes

Release 1.1 (August 1, 2009)

When upgrading to this version, please be aware that "Skip on SCM build" (Default Yes) is becoming "Poll SCM" (Default No) under Triggers section. Due to technical limitation, this data could not be migrated to 1.1, and therefore if it was unchecked in certain jobs, the new box should be manually checked.

Release 1.0.1 (June 3, 2009)

Release 1.0 (May 20, 2009)

Labels:

plugin-external plugin-external Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. Mar 27, 2009

    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.

    1. 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).

  2. 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

    1. May 29

      Freddy Mallet says:

      Hi Gabriel, I've created ticket SONARPLUGINS-100. This should be fixed with vers...

      Hi 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

  3. May 27

    Edgar Miller says:

    Hi there, I am trying to install the plugin in Hudson 1.307, but getting alway...

    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.

    1. May 29

      Freddy Mallet says:

      See this thread. We can't manage to reproduce the issue.

      See this thread. We can't manage to reproduce the issue.

  4. 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

  5. Jul 29

    Lou Parisi says:

    Thanks for this plugin.  I am just trying out today and it seems very usefu...

    Thanks for this plugin.  I am just trying out today and it seems very useful.  Is there any way to add a link to the sonar project page from the hudson project page?

    1. Aug 05

      Freddy Mallet says:

      Good idea ! I've created JIRA ticket SONARPLUGINS-165.

      Good idea ! I've created JIRA ticket SONARPLUGINS-165.

  6. Sep 30

    Lasse Bergström says:

    Hi, I still get the same thing "Cannot execute mojo: sonar. It requires a proje...

    Hi,

    I still get the same thing "Cannot execute mojo: sonar. It requires a project with an existing pom.xml, but the build is not using one" as Gabriel gets above. We have 1.1 installed.

    Any clue?

    Best regards

    /Lasse

  7. Sep 30

    Lasse Bergström says:

    Hi, I still get the same thing "Cannot execute mojo: sonar. It requires a proje...

    Hi,

    I still get the same thing "Cannot execute mojo: sonar. It requires a project with an existing pom.xml, but the build is not using one" as Gabriel gets above. We have 1.1 installed.

    Any clue?

    Best regards

    /Lasse