Grails Clover Plugin Developer Guide

This plugin integrates with Grails 2.x and is no longer maintained. Consider using a Gradle Clover Plugin for Grails 3.0 and newer.

Preconditions

  • Install Grails 2.0.4 and set $GRAILS_HOME 
    • the minimum Grails version required to run the plugin is 2.0.0 (see CloverGrailsPlugin.groovy)
    • the compilation and deployment of the plugin is done using 2.0.4 (see application.properties)
  • Set JAVA_HOME to JDK 1.7+ (otherwise you'll end up with java.lang.NoClassDefFoundError: org.codehaus.gant.GantBuilder error)
  • Clone the repository:
git clone ssh://git@github.com/openclover/grails-clover-plugin.git

Build and test

To build the plugin and to run unit tests type:

grails package-plugin
grails test-app

 

To run integration tests:

  1. Install the artefact

    grails test maven-install # it puts zip into local Maven cache ~/.m2

    (lightbulb) By default maven-install and publish-plugin targets are switching environment context to "production" and our CloverGrailsPlugin.groovy has def environment = ["test"] declared. Therefore you have to force switch of environment context by "grails test ...", otherwise a build fails.

     

  2. Test it against the enclosed Grails test applications located in /testcases directory.
    1. Update Clover plugin number in <grails>/testcases/<project>/grails-app/conf/BuildConfig.groovy, e.g.:

      plugins {
          build ":clover:4.4.0"
      }
    2. Switch to proper Grails version - set GRAILS_HOME and PATH variables according to test project's settings.

    3. Change directory to <grails>/testcases/<project_name> and run

      grails test-app -clover.on

Creating a pull request

In case you'd like to have your changes included in the official release:

  1. Fork grails-clover-plugin repository and clone the fork into your workstation. 
  2. Implement the change (also write unit or integration tests). Commit changes.
  3. Create a pull request for grails-clover-plugin project
    1. Ensure any new features / configuration options are documented in the pull request description.

Release and publish

In case you'd like to build a new release on your own:

Preconditions

You must be a member of the Grails Plug-in Development team:

Steps

  1. Increment the version number in <grails>/CloverGrailsPlugin.groovy and commit this, e.g. 
        def version = "4.4.0"
  2. Update <grails>/grails-app/conf/BuildConfig.groovy and change the version of Clover Core required (if necessary), e.g.
        core.version = 'org.openclover:clover:4.4.0'
  3. Build the plugin via:
        grails package-plugin
        grails test maven-install 
  4. Test it against the enclosed Grails test applications located in /testcases directory
  5. Create a tag for new version, e.g:
        git tag grails-clover-plugin-4.4.0
    and push code changes:
        git push
  6. Push the plugin to Grails Central via:
        grails test publish-plugin --plain-output --verbose
  7. Test that the zip has been pushed to the Grails Central and exists at: https://grails.org/plugin/clover and is being listed via:
        grails list-plugins
       (lightbulb)You may have to wait few minutes before it becomes visible; if not - contact dev@grails.codehaus.org
  8. Test that plugin can be installed, e.g.: 
        grails install-plugin clover 4.4.0
        (lightbulb) Make sure that clover-X.Y.Z.zip  is not available locally in ~/.m2, ~/.ivy2, ~/.grails/X.Y.Z/*, ~/.grails/ivy_cache to check that it indeed downloads from Grails Central and not your cache.
  9. Update plugin's documentation on https://grails.org/plugin/clover.

Binaries

Stable releases can be downloaded from Grails Plugins site.

Further reading

See Creating Grails plugins using Clover.