Grails Clover Plugin Developer Guide

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.6+ (otherwise you'll end up with java.lang.NoClassDefFoundError: org.codehaus.gant.GantBuilder error)
  • Clone the repository from Bitbucket:
hg clone ssh://hg@bitbucket.org/openclover/grails-clover-plugin

 (warning) This is Mercurial repository, not 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.2.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.2.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.2.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:
        hg tag grails-clover-plugin-4.2.0
    and push code changes into Bitbucket:
        hg 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: http://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.2.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 http://grails.org/plugin/clover.

Binaries

Stable releases can be downloaded from Grails Plugins site.

Further reading

See Creating Grails plugins using Clover.