27 Dec 2011

Updating Grails JodaTime Plugin

Joda Time is a Java library that provides a replacement for the Java date and time classes. Since it's a Java library, it integrates easily with Grails.

As of this writing, the current version of the Grails Joda Time Plug-in is version 1.3.1 and it bundles Joda Time version 1.6.2 but the current release of Joda Time is 2.0 which includes new features that I would like to use. Specifically, I'd like to use the withTimeAtStartOfDay method to easily determine the start of day in the users current time zone.

These are the brief steps I took to update the Joda Time library after installing the existing Joda Time Plugin.

- Download the latest Joda Time library.
- From the zip or tar.gz file, copy the joda-time-2.0.jar file to $HOME/.grails/<grails-vers>/projects/<project-name>/plugins/joda-time-1.2/lib
- Edit the file $HOME/.grails/<grails-vers>/projects/<project-name>/plugins/joda-time-1.2/dependecies.groovy and change  the

compile "joda-time:joda-time:1.6.2"


compile "joda-time:joda-time:2.0"

Execute the command:

$ grails clean