The usually simple upgrade process in Grails has caused me a few headaches in moving from 1.2.2 to 1.3.1. I skipped the 1.3 upgrade because there were a few people having issues on the mailing list but yesterday I bit the bullet and encountered a couple of problems.
I think the release notes for Grails 1.3.x have been unusually poor so this post has the issues I’ve encountered in the hope that you won’t go quite as mad as I have. I’ll keep it updated if I find more problems.
Controller defaultAction must now be static
Not much more to say, but if like me you’ve been doing this in your controllers:
def defaultAction = "open"
you’ll need to do this instead:
static defaultAction = "open"
Otherwise you’ll get a tomcat 404 error saying that “resource() is not available”
Missing dependencies
Now I can’t say if this was me doing something wrong or a problem with the upgrade process, but when I tried to run my app for the first time I got all sorts of dependency problems. I don’t use Maven, or any Maven repos (in fact I don’t like Maven, but that’s another post for another day) but I was getting lots of Maven output suggesting lookups for every dependency were being made to a remote repo.
I eventually solved the problem by adding grailsCentral() to my repositories in the build.config, quite why it wasn’t there in the first place I don’t know:
grails.project.class.dir = "target/classes" grails.project.test.class.dir = "target/test-classes" grails.project.test.reports.dir = "target/test-reports" grails.project.dependency.resolution = { inherits("global") { } log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose' repositories { grailsPlugins() grailsHome() grailsCentral() } dependencies { runtime 'mysql:mysql-connector-java:5.1.5' } }
We can’t modify the Groovy-based config files at the moment, so if you already had a BuildConfig.groovy the upgrade script wouldn’t add the ‘grailsCentral()’ entry (which was introduced with Grails 1.3).
Point taken about the upgrade notes and we will try to do that better next time.
Peter