How do I configure Grails JVM in IntelliJ
I'm using IntelliJ 10.0.3 on a Mac running OS X 10.5.8.
Typically I use maven to compile and run my grails app, but I would also like to be able to run the grails configuration that gets generated for me in IntelliJ.
If I configure a maven build to...
mvn grails:run-app
Everything works fine. I can see from the console that IntelliJ uses JVM 1.6
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java .....
However if I run the grails configuration, supposedly simply
grails:run-app
I can see in the console that IntelliJ uses JVM 1.5
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/bin/java .....
The command ultimately fails, and my assumption is because it's using 1.5 and not 1.6, which I'm targeting in my maven POM. I have the BuildConfig.groovy settings configured to use the pom.
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Unable to start Grails
Embedded error: java.lang.reflect.InvocationTargetException
That assumption could be off, but I would love to know where the JVM is configured in IntelliJ for this? I can't find anything reguarding what JVM to use when running a grails config. The default JVM should be 1.6 for me, so I'd just like to know why 1.5 is being used. Any help would be greatly appreciated. Thanks!
Please sign in to leave a comment.
The project JDK is set in File->Project Structure->Project (see screen shot)

Thanks Michael,

I thought that would do the trick too, but my project is set to 1.6. As far as I can tell the grails portion is the only thing not using 1.6. Maybe that's configured outside of IntelliJ somewhere??
Is there a stack trace associated with that error? Is it related to some XML parsing classes?
Starting with a somewhat recent version of Grails (1.3.6 I think) it has some class loading bug dealing with xml-apis. If it is related to XML classes you probably need to delete xml-apis from your Ivy and/or Maven cache.
Without knowing if there is a stack trace associated with your error it is hard to know if this advice applies to your issue though.
If removing xml-apis from your cache doesn't help check your ANT version. If you are using 1.3.5 or prior you need to use ANT 1.7 not 1.8.
See: http://jira.grails.org/browse/GRAILS-6897