Sonar plugin

Plugin Information

Plugin ID sonar
Latest Release 1.2.2
Latest Release Date Feb 03, 2010
Changes via Fisheye In Latest Release
Since Latest Release
Maintainer(s) Evgeny Mandrikov (id: godin)
Simon Brandhof (id: sbrandhof)
Cedric Munger (id: cmunger)
Carlo Jelmini (id: cjelmini)
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, ....

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
Plugin 1.2.1
Sonar
1.8+
1.8+
1.8+
Hudson
1.306+ 1.317+ 1.341+

Support

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

Release notes

Release 1.2.1 (February 1, 2010)

This version introduces some changes to configuration files. Upgrade will be performed automatically, but before upgrade please make a backup of your Hudson configuration.
Most probably next plugin version will be incompatible with versions below 1.2, so it's highly recommended to update to this version.

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, 2009

      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, 2009

    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, 2009

      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, 2009

    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, 2009

      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, 2009

    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, 2009

    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, 2009

      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

  8. Jan 28

    a311955 says:

    I'm using Hudson 1.340, Sonar 1.9 and plugin version 1.1, but I cannot seem to g...

    I'm using Hudson 1.340, Sonar 1.9 and plugin version 1.1, but I cannot seem to get Hudson to see my Sonar installation.  The only choice for "Sonar Installation" dropdown list is "default".  When I tried to build anyway it told me "No Sonar installation on this job. , available installations count : 0"

    Sonar is installed at the default 9000 port and I can hit the URL, and both Hudson and Sonar are on the same server.

    1. Jan 28

      Evgeny Mandrikov says:

      Go to Hudson configuration page and configure Sonar installations.

      Go to Hudson configuration page and configure Sonar installations.

  9. Jan 28

    a311955 says:

    There's no installation to configure, the only choice is "default" and clicking ...

    There's no installation to configure, the only choice is "default" and clicking on that does nothing, ie. no new boxes to fill

    I forgot to mention we aren't using Maven, we use only ANT for building.

    Here's a screenshot: http://i47.tinypic.com/2ii7vox.jpg

    1. Jan 28

      Evgeny Mandrikov says:

      It would be better if you can provide screenshots. But in any case: have a look...

      It would be better if you can provide screenshots.

      But in any case: have a look on this article http://sonar.codehaus.org/a-new-hudson-plugin-for-a-closer-integration-with-sonar/

      1. Jan 28

        Evgeny Mandrikov says:

        And again: Go to Hudson global configuration page and configure Sonar installati...

        And again: Go to Hudson global configuration page and configure Sonar installations.
        Eg:
        1) my hudson installed here: http://localhost:8080/hudson
        2) global configuration can be found here: http://localhost:8080/hudson/configure
        3) Sonar installations can be added in section "Sonar" by pressing button "add"

        1. Jan 28

          a311955 says:

          Thanks for the quick reply, I'm past that point now.

          Thanks for the quick reply, I'm past that point now.

  10. Feb 02

    newguy says:

    I got this warning when trying to install 1.2.1 to Hudson 1.343: WARNING: Faile...

    I got this warning when trying to install 1.2.1 to Hudson 1.343:

    WARNING: Failed to resolve class
    com.thoughtworks.xstream.mapper.CannotResolveClassException: hudson.plugins.sonar.SonarPublisher : hudson.plugins.sonar.SonarPublisher

    and Hudson is unable to start after installing the plugin.

  11. Feb 03

    Jean-Pol Landrain says:

    Upgrade from 1.1 to 1.2.1 doesn't work for me (and Hudson was restarted, version...

    Upgrade from 1.1 to 1.2.1 doesn't work for me (and Hudson was restarted, version is 1.333).

    With 1.2.1, it tells that there is no maven goal specified on the command line.

    Reverted to 1.1 and it works again.

    1. Feb 03

      Wilfried Charpentier says:

      Hi, I'm facing the same problem with 1.2.1 and Hudson 1.343. Hudson was restart...

      Hi,

      I'm facing the same problem with 1.2.1 and Hudson 1.343. Hudson was restarted too.