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 section
runtime “: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:

compile “:scaffolding:2.0.0”

Problem 2: Running in Debug Mode

1. Edit Configurations, set command line to: run-app -debug
2. Goto BuildConfig.groovy and comment out the run portion of jvm settings:
//run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
3. Click on debug icon

Problem 3: Tomcat does not start and ends up with error

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[/project1]]

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.

Advertisements