views:

87

answers:

3

Is there a way to use the ivy cache grails dependency DSL creates within an IDE like eclipse or netbeans? Or must I manually add all dependencies to the IDE lib folder?

I've looked into plugins like ivybeans and ivyde, but they seem to require ivy.xml and ivysettings.xml files, which grails does not produce.

A: 

IntelliJ syncs dependencies between Grails (form application.properties and BuildConfig.groovy) and the IDE very nicely.

Stefan
A: 

The Grails tooling provided by the SpringSource Tool Suite plugin for Eclipse has the functionality you desire. It reads BuildConfig.groovy and modifies the project classpath accordingly.

BungleFeet
I'm using the SpringSource Tool Suite plugin for Eclipse, and it currently does not recognize the ivy cache (I get the red squiggly lines indicating missing dependencies). Any ideas why? Thanks.
ABK07
I've noticed similar behaviour sometimes, although the app still builds and runs without errors. Sometimes the squiggles appear on internal project references, which is strange, but often you can get rid of these by doing Project->Clean from the Eclipse menubar.I blogged about a solution to a similar problem with Spock dependencies (see http://www.lazygun.net/how-to-fix-some-annoying-errors-that-pop-up-w ), that may point you in the direction of a solution to your problem.
BungleFeet
Just to check: you have enabled Grails dependency management for your project, right? (Right click on project in the Package Explorer, and choose Grails->Enable dependency management).
BungleFeet
Yes, I have enabled Grails dependency management for my project. When I click Grails->Refresh dependencies eclipse notifies me that "Errors exist in required project(s): webapp" When I proceed with the refresh, in the console window I get: "Calculating dependencies... Grails home: /home/abk/grails-1.3.2/ Project home: /data/workspace/trunk/webapp ...done" Upon completion of the refresh, the squiggly lines remain. I've even tried Project->Clean, but that does nothing... Any other ideas? Thanks.
ABK07
Any pattern to the classes Eclipse can't find? As I mentioned before, I had similar problems with some dependencies of the Spock plugin, which I solved by manually adding some of the plugin dependencies to my BuildConfig file.
BungleFeet
There seems to be no pattern. I have manually added the dependencies Eclipse could't find to my BuildConfig file, specifically I added -- javax.validation, hibernate-validator, and cxf-bundle-minimal. But Eclipse STS still does not recognize the jars.
ABK07
Hmm, that's got me stumped. The only other thing I can suggest is to raise an issue on the STS JIRA, and one of the development team will get back to you on it.
BungleFeet
A: 

I just attached the following to the Jira bug.

In snooping around the STS distribution, I found the following code in C:\springsource\sts-2.3.2.RELEASE\configuration\org.eclipse.osgi\bundles\898\1.cp\src\com\springsource\sts\grails\core\model\GrailsBuildConfig.java

// make sure that we use the Ivy dependency resolution strategy for Grails 1.2 // TODO CD make version number detection more flexible if (settings.getGrailsVersion().startsWith("1.2")) { jarFiles.addAll(settings.getTestDependencies()); jarFiles.addAll(settings.getProvidedDependencies());

Based on this find, I tried downgrading my project from Grails 1.3.2 to Grails 1.2 and ran "refresh dependencies". Sure enough, the dependencies were correctly loaded from Ivy.

Looks like someone needs to do the TODO. I can take a stab at it once I figure out how to check out the source code...