Version Information
Plugin | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 |
|---|---|---|---|---|---|
CodeNarc | 0.9 | 0.9 | 0.13 | 0.15 | 0.16.1 |
GMetrics | 0.2 | 0.2 | 0.3 | 0.3 | 0.4 |
cobertura-maven-plugin |
| 2.4 | 2.5 | 2.5 | 2.5.1 |
Description / Features
This plugin enables the analysis of Groovy projects. To do so, it leverages Squid to calculate basic metrics, CodeNarc for coding rules violations, Gmetrics for cyclomatic complexity and Cobertura for code coverage.
Installation
Place the JAR file of the plugin in /extensions/plugins of your Sonar installation. Restart sonar.
Usage
Maven projects
If you project is built with Maven, you should add in your pom
to the build section and :
Non-maven projects
If you project does not use Maven as a build engine, you should create a small pom.xml file at the root of you project and have the following content in it :
Running analysis
To kick-off the analysis, run mvn sonar:sonar
Advanced usage
It is possible to reuse some reports already existing for GMetrics and CodeNarc. To do so, use sonar.groovy.gmetrics.reportPath or sonar.groovy.codenarc.reportPath.
Known limitations
- When running the search for duplications, the Groovy lexer will sometimes output some exceptions. It does not stop the Sonar plugin to work, but the will not run comprehensive copy/paste detection on those files. This issue should be fixed in Groovy 1.7. See SONARPLUGINS-596.
- The source directory must be added to the pom.xml, even if the project is built with Maven. This comes from the fact that Sonar does not call gmaven plugin.
- Inner classes are not processed in the current version and will therefore not be reported. See SONARPLUGINS-597.
Changelog

