IntelliJ Idea 13 EAP and Grails 2.3.0

While the news is that IntelliJ 12.x will support Grails 2.3.0 sooner or later, right now the best bet is to use IDEA 13 EAP release. But the release has a few issues, which is good to be aware of while developing for Grails 2.3.0.

Problem 1: Migrating to Grails 2.3.0

While the built-in upgrade does a decent job of setting the Idea settings, you must ensure the following:

1. Add this to BuildConfig.groovy

grails.project.dependency.resolver = “maven” // or ivy

2. Set the tomcat version in plugins section

build “:tomcat:7.0.42”

3. Set the correct hibernate version in plugins sectionruntime “:hibernate:3.6.10.1” // or “:hibernate4:4.1.11.1”

These do not rely on $grailsVersion anymore. If you are using scaffolding, you have to specify that as a dependency too:

This one was a real tough nut to crack, because of an accidental mistake. Tomcat refused to start, and I didnt know what setting I had really changed.

It turns out that in the Edit Configurations… window, I had accidentally turned on the “Add –classpath” checkbox. This added the maven related servlet-2.5 api classes, that gave the above error. I was hunting the wrong path for quite sometime (switching between 2.5 and 3.0, clean-all, refresh-dependencies) and several other guesses. Finally when I turned off this checkbox, the application started fine.