Archive for the ‘Maven’ Category.

Maven Sonar plugin for your Java project

I needed to add Sonar reporting to a small Java project that uses Maven for the build. There is a Maven Sonar plugin available for this task here.

First add sonar properties file ( ) to your java project, put it in root.

# info
sonar.projectName=Sample java spring MVC project

# Comma-separated paths to directories with sources (required)

# Language

# Encoding of the source files

Make Maven aware of the Sonar location etc, add that to the Maven settings \maven\conf\settings.xml

Something like this

          <!– SERVER ON A REMOTE HOST –>

For Maven version 3+ add this to the POM file in the build section, else Maven version 2 ( below ).


For Maven 2.


Pass the sonar:sonar goal to the Maven script then kick off a build, the dependencies should be downloaded automatically. The report for your project displays on the Sonar server dashboard.