Another step towards a final release of Maven 3.0 was made the other day when version 3.0-beta-2 was released. I’ve been using Maven 3 since its alpha days, and despite the alpha/beta moniker, I find it to be superior to any Maven 2.x version. If you are starting a new project, I strongly recommend using Maven 3.
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.
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:
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.