That being said, in the complete development environment there are a few missing pieces when working with Maven 3. One of these is getting Sonar to work with Maven 3, which had not been possible until the latest version of Sonar was released.
This post will explain how to get Maven 3 and Sonar to work together.
To get started, the first thing you must do is install Sonar 2.2 and Maven 3.0-beta-1 or later. No extra configuration of Sonar is required for Maven 3, and the same configuration of properties in Maven also applies. Please note that the URL for the Sonar server -- sonar.host.url -- must not end with a slash character.
The difference when using Maven 3 lies in the Maven plugin. Currently, the plugin at Codehaus Mojo doesn’t work with Maven 3, so you need to use the one at the Sonar project instead.
Now, in your Maven project, execute the command below. Until the Sonar Maven plugin at Codehaus Mojo is updated with Maven 3 support, this is the command to use:
mvn org.codehaus.sonar:sonar-maven3-plugin:2.2:sonar
Your project should now be analyzed and the result uploaded to Sonar.
One thing to be aware of is that you need to align the version of sonar-maven3-plugin with the version of Sonar that is installed. When you upgrade Sonar, you need to change the version on the Maven side as well.
To view the progress of Maven 3 support in the plugin at Codehaus Mojo, follow MOJO-1545.