views:

977

answers:

3

Hi All,

So I finally got my dependencies working with Grails. Now, how can my IDE, eg IntelliJ or Eclipse, take advantage of it? Or do I really have to manually manage what classes my IDE knows about at "development time"?

If the BuildConfig.groovy script is setup right (see here), you will be able to code away with vi or your favorite editor without any troubles, then run grails compile which will resolve and download the dependencies into the Ivy cache and off you go...

If, however, you are using an IDE like Eclipse or IntelliJ, you will need the dependencies at hand while coding. Obviously - as these animals will need them for the "real time" error detection/compilation process.

Now, while it is certainly possible to code with all the classes shining up in bright red all over the place that are unknown to your IDE, it is certainly not much fun...

The Maven support or whatever it is officially called lives happily with the pom file, no extra "jar directory" pointers needed, at least in IntelliJ. I would like to be able to do the same with Grails dependencies.

Currently I am defining them in the BuildConfig.groovy and additionally I copy/paste the current jars around on my local disk and let the IDE point to it.

Not very satisfactory, as I am working in a highly volatile project module environment with respect to code change. And this situation ports me directly into "jar hell", as my "develop- and build-dependencies" easily get out of sync and I have to manage manually, that is, with my brain...

And my brain should be busy with other stuff...

Thanks! Raoul

P.S: I'm currently using Grails 1.2M4 and IntelliJ 92.105. But feel free to add answers on future versions of Grails and different, future IDEs, as the come in...

+1  A: 

Did you try

grails integrate-with --intellij

At least in 1.2.0RC1 this creates the intellij project files - but I'm not sure if the dependencies are also managed by this one.

Stefan
In 1.2M4, there is no such thing as integrate-with...
raoulsson
use 1.2.0.RC1 - there it is.
Stefan
Thanks Stefan. I just downloaded 1.2.0.RC1 and IntelliJ Release 9.0. I created a project in the shell, added dependencies from maven (joda-time), created a controller that imports DateTime, compiled it. All good. Then run "grails integrate-with --intellij", creates the project files but the IDE doesn't recognize the dependencies afterwards :-/
raoulsson
I'm still working with IntelliJ 8.1 - this works fine. I've saw a blog post that Intellij 9 EAP has some bug fixes for Grails - maybe use that one.
Stefan
+2  A: 

This is fixed in the latest EAP build: 94.173 -> http://youtrack.jetbrains.net/issue/IDEA-50459#content-tab=1

Download it here: http://www.jetbrains.net/confluence/display/IDEADEV/Maia+EAP

Grails 1.2.1 and IntelliJ Build# 93.94 (version 9.0.1) and I have the same problem. The only way I've gotten it to work is with manually adding the libraries from my maven projects (Under ~/.ivy2/) Otherwise, download the EAP build listed above.

Further, grails integrate-with --intellij does not work. And, in fact, leads to worse problems. The built-in integration in IntelliJ is much better than what grails gives you.

Mike
@mike Sounds promising. I will test this ASAP. Thanks
raoulsson
A: 

You may have figured this out by now, but I was having the same problem. See

http://stackoverflow.com/questions/2774497/intellij-idea-grails-not-seeing-jar

Steve Wall