Chapter 12. Upgrading Applications and Plugins

New Grails versions are released fairly often, and they always contain bug fixes and new features that you probably want to have available in your applications and plugins. You might not be able to upgrade for every release, but you shouldn’t get too far out of date. We try our best to limit breaking changes and other changes that will make upgrading harder, but sometimes progress has its costs.

Grails does have an upgrade script, but it doesn’t do all of the work needed to upgrade between versions, and will likely be removed or at least renamed in a future version of Grails, because the name is a bit misleading. It is useful in some respects, but there will always be manual steps involved in upgrading to a newer version of Grails.

So what does the upgrade script do? There are a few fixes for very old (pre-1.0) applications:

  • Delete basedir/plugins/core (core taglibs are now part of Grails, not files in the application)
  • Move basedir/grails-tests test classes to test/integration
  • Delete basedir/tmp
  • Move basedir/spring and basedir/hibernate under basedir/grails-app/conf

and there are fixes for all versions:

  • Copy current static resources (images, CSS, JS) to basedir/web-app
  • Replace basedir/web-app/WEB-INF/sitemesh.xml and basedir/web-app/WEB-INF/applicationContext.xml with the latest versions
  • Copy current *.tld files to basedir/web-app/WEB-INF/tld
  • Create missing grails-app/conf files (Config.groovy, BuildConfig.groovy, DataSource.groovy ...

Get Programming Grails now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.