Plugins You can find out about all the publicly available Grails plugins.


  • Tags: quality, metrics
  • Latest: 0.3.1
  • Last Updated: 11 January 2011
  • Grails version: 1.2.2 > *
  • Authors: null
1 vote
compile "org.grails.plugins:gmetrics:0.3.1"




grails install-plugin gmetrics


Gmetrics Plugin

The Gmetrics Plugin provides static code analysis for Groovy code. It uses the Gmetrics] library.

The GMetrics project provides calculation and reporting of size and complexity metrics for Groovy source code. GMetrics scans Groovy source code, applying a set of metrics, and generates an HTML report of the results.

Total and average values for the following metrics are provided:

  • Cyclomatic Complexity.
  • ABC Size/Complexity. Also see the C2 Wiki page.
  • Lines per method
  • Lines per class


To integrate the plugin into your application just run the 'install-plugin' Grails script, e.g.

grails install-plugin gmetrics


The plugin provides a script 'gmetrics' that will analyze your code and write its results to an HTML file. Run

grails gmetrics
to perform the analysis.


The plugin requires no customization to run. By default it will analyze all Groovy files in

  • src/groovy
  • grails-app/controllers
  • grails-app/domain
  • grails-app/services
  • grails-app/taglib
  • grails-app/utils
  • test/unit
  • test/integration
and use a default title and report name. You can restrict which folders are included or add extra ones. The (optional) "" file can be located in the project base directory. The following table lists settings that will be read from grails-app/Config.groovy and used if available:

PropertyDefault ValueMeaning
gmetrics.outputFiletarget/GMetricsReport.htmlthe path and name of the analysis report file report type; valid values are 'html', 'xml' and 'text', or the fully-qualified class name of a ReportWriter class
gmetrics.reportTitleGMetrics Reportthe report title
gmetrics.processSrcGroovytruewhether to analyze source in src/groovy
gmetrics.processControllerstruewhether to analyze source in grails-app/controllers
gmetrics.processDomaintruewhether to analyze source in grails-app/domain
gmetrics.processServicestruewhether to analyze source in grails-app/services
gmetrics.processTaglibtruewhether to analyze source in grails-app/taglib
gmetrics.processTestUnittruewhether to analyze source in test/unit
gmetrics.processTestIntegrationtruewhether to analyze source in test/integration
gmetrics.extraIncludeDirsnoneextra source directories to include; for example to include Quartz job files, specify
to add the pattern 'grails-app/jobs//*.groovy' to the analysis fileset

See GMetrics for more information on Gmetrics configuration options.

Please report any issues to the Grails User mailing list and/or write up an issue in JIRA at under the Grails-Gmetrics component.


Licensed under the Apache License, Version 2.0. See


  • January 11, 2011 (Version 0.3.1)
    • Change default target to gmetrics from default
  • August 11, 2010 (version 0.3)
    • Support for version 0.3 of gmetrics
    • Change dependency to provided so it is no longer packaged in the war
  • June 3, 2010 (version 0.2.1)
    • Support for report name and output file name as configurable parameters
  • June 1, 2010 (version 0.2)
    • released initial version 0.2