Skip to content

Plugin Reference

badamowicz edited this page Oct 7, 2014 · 6 revisions

Beware that the description of the plugin shown here are auto-generated from the code's documentation. You may reproduce them any time by issuing

mvn com.github.badamowicz:sonar-hla-maven-plugin:help

which will give a list and descriptions for all plugin goals available. If you need help for a particular goal, simply issue

mvn com.github.badamowicz:sonar-hla-maven-plugin:help -Ddetail=true -Dgoal=extract

Goals

sonar-hla:extract

Mojo is capable of extracting resource data from a SonarQube server. It will perform all necesary steps from extracting the data up to providing those in an appropriate way.

Available parameters are:

  • cleanValues (Default: false)

    When set to true, no non-numeric characters will be contained in the generated data.

    User property: cleanValues

  • hostUrl (Default: http://localhost:9000)

    The URL pointing to the SonarQube host.
    
    Required: Yes
    
    User property: hostUrl
    
  • measures

    A comma separated list of names of measures which will be used to retrieve
    the data. To see which measures are available inside Sonar-HLA, just
    execute the goal showMeasures.
    Example: ncloc,coverage,duplicated_lines
    
    If no measures are given, all available measures will be retrieved.
    
    User property: measures
    
  • password

    The password for a given user. Beware this password will not be encrypted
    in any way!
    
    User property: password
    
  • projectKey

    For retrieving a single project, just give the project's key here.
    Example: com.github.badamowicz.sonar.hla:sonar-hla. This property is
    mutual exclusive with the property projectKeyPattern! If both properties
    are given, an exception will be thrown. If none of these properties is
    given, then all projects will be retrieved.
    
    User property: projectKey
    
  • projectKeyPattern

    For retrieving a set of projects matching the given pattern. This property
    is mutual exclusive with the property projectKey! If both properties are
    given, an exception will be thrown. If none of these properties is given,
    then all projects will be retrieved.
    
    User property: projectKeyPattern
    
  • surroundFields (Default: false)

    If true, every single field of data will be surrounded with quotation
    marks.
    
    User property: surroundFields
    
  • userName

    The user name for accessing the SonarQube host.
    
    User property: userName
    
  • csvFile

    If this parameter is given, the CSV data will also be written to the given
    destination file. May be a relative or an absolute file path.
    
    User property: csvFile
    
  • aggregate (Default: false)

    If this parameter is set to true, be sure to also give a project pattern
    using the 'projectKeyPattern' property. Then all values of all selected
    projects will be aggregated. That is, either the sum or the average is
    calculated from all measures of all projects. The result is then a single
    aggregated project and the CSV content will contain only one line with
    these aggregated data.
    
    User property: aggregate
    

Example:

$ mvn com.github.badamowicz:sonar-hla-maven-plugin:extract -DhostUrl=http://your.host.rl:9000 -DuserName=admin -Dpassword=admin
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sonar-hla-maven-plugin:0.4.1:extract (default-cli) @ standalone-pom ---
14:43:20,869  INFO ExtractorMojo:221 - Initialized 10 measures.

**** Here we go with CSV:

Project;Lines of Code;Coverage [%];Complexity;Duplicate Lines;Issues;Blocker;Critical;Major;Minor;Info
com.github.badamowicz.sonar.hla:sonar-hla-parent;600;87.7%;102;0;27;0;0;27;0;0
com.github.badamowicz:sonar-hla-parent;600;87.7%;102;0;27;0;0;27;0;0


**** End of CSV data. Have a nice day!

 _____________________________
< Sonar High Level API - Moo! >
 -----------------------------
  \
   \   \_\_    _/_/
    \      \__/
           (oo)\_______
           (__)\       )\/\
               ||----w | ░
               ||     || ░░
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.330s
[INFO] Finished at: Fri Aug 29 14:43:21 CEST 2014
[INFO] Final Memory: 3M/15M
[INFO] ------------------------------------------------------------------------

sonar-hla:showMeasures

This Mojo actually performs no actions at all. It simply displays all available measures inside Sonar-HLA. Those measures can then be used to configure ExtractorMojo.

This goal has no parameters.

Example call:

$ mvn com.github.badamowicz:sonar-hla-maven-plugin:showMeasures
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sonar-hla-maven-plugin:0.4.1:showMeasures (default-cli) @ standalone-pom ---

Available measures are:
======================
 - ncloc
 - coverage
 - complexity
 - duplicated_lines
 - violations
 - blocker_violations
 - critical_violations
 - major_violations
 - minor_violations
 - info_violations
 _____________________________
< Sonar High Level API - Moo! >
 -----------------------------
  \
   \   \_\_    _/_/
    \      \__/
           (oo)\_______
           (__)\       )\/\
               ||----w | ░
               ||     || ░░
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.393s
[INFO] Finished at: Fri Aug 29 14:38:04 CEST 2014
[INFO] Final Memory: 3M/15M
[INFO] ------------------------------------------------------------------------

sonar-hla:help

Display help information on sonar-hla-maven-plugin. Call mvn sonar-hla:help -Ddetail=true -Dgoal= to display parameter details.

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