Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make use of Grails Dependencies in your IDE

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...

like image 209
raoulsson Avatar asked Dec 08 '09 20:12

raoulsson


3 Answers

If you have Eclipse with Grails plugin just run: Grails Tools->Refresh Dependencies (actually I have tried this with STS).

like image 130
Marek Avatar answered Oct 04 '22 13:10

Marek


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.

like image 33
Mike Avatar answered Oct 04 '22 13:10

Mike


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.

like image 29
Stefan Armbruster Avatar answered Oct 04 '22 13:10

Stefan Armbruster