Quick Start Maven Plugin

badamowicz edited this page Oct 7, 2014 · 5 revisions

The Sonar-HLA Maven Plugin just wraps the API and hence provides an easy way to use Sonar-HLA from the command line or from a build job. With this example, CSV is generated and printed to console. (Remove the line breaks if you copy this example)

mvn com.github.badamowicz:sonar-hla-maven-plugin:0.4.1:extract

This will extract all Projects matching the pattern ".*sonar-hla.*" and generate CSV from it. You will get only cleaned up values (e.g. no '%' signs will be contained) and every field in the generated CSV will be surrounded with quotation marks. For the measures, only lines of code and the coverage is extracted. The CSV is printed to console and will look like his example:

"Project";"Lines of Code";"Coverage [%]"

If you want to extract all measures from all projects from a Sonar host, and Sonar is running on localhost with its default port, you may simply use all the default values from the plugin. This will melt down the command line to

mvn com.github.badamowicz:sonar-hla-maven-plugin:0.4.1:extract

If you like it even shorter, add these settings to your file $HOME/.m2/settings.xml:


Then you can simply issue:

mvn sonar-hla-maven-plugin:0.4.1:extract


mvn sonar-hla-maven-plugin:extract

The CSV now might look like this:

Project;Lines of Code;Coverage [%];Complexity;Duplicate Lines;Issues;Blocker;Critical;Major;Minor;Info

Maybe you may also want to refer to my homepage as well as my Blog which contains various posts about different aspects of Software Management, Continuous Integration and some related stuff.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.