Using Ivy for Dependency Resolution
Although Grails does not currently support Maven 1/2 it does come with support for dependency resolution (the main selling point of Maven) via
Ivy.
Pre 1.0 Grails shipped Ivy as part of the core and to get started type the following from the root of your project:
Since 1.0 the Ivy integration is now a plug-in. To install Ivy do the following:
grails install-plugin ivy
Both commands, pre 1.0 and since 1.0, will create an ivy.xml and an ivyconf.xml. You can edit the ivy.xml to define your dependencies. For example:
<ivy-module version="1.0">
<info organisation="codehaus" module="grails"/>
<dependencies>
<dependency org="apache" name="commons-lang" rev="2.1"/>
<dependency org="apache" name="commons-cli" rev="1.0"/>
<dependency org="apache" name="commons-beanutils" rev="1.7.0"/>
<dependency org="apache" name="commons-collections" rev="3.2"/>
<dependency org="apache" name="commons-logging" rev="1.1"/>
<dependency org="apache" name="commons-pool" rev="1.2"/>
<dependency org="apache" name="commons-validator" rev="1.3.0"/>
<dependency org="dom4j" name="dom4j" rev="1.6.1"/>
<dependency org="junit" name="junit" rev="3.8.1"/>
</dependencies>
</ivy-module>Then when you run a Grails project the dependencies will be resolved first. If you want to add a local JAR repository you can change ivyconf.xml to add your local server. The default configuration resolves from Maven's ibiblio repository.
Whenever you wish to update your dependencies use:
It is crappy and slow, but it's all that we have :)
1 Comment
Post a Comment
Site Login