Last updated by gorshing 3 years ago

Using Ivy for Dependency Resolution

Ivy Support in Grails 1.2 and above

Since Grails 1.2 and above, Grails features a new dependency resolution DSL built on Ivy. The ivy.xml file is redundant and purely used for kicking off an Ant build on a CI server (ie DO NOT use it to declare dependencies!). See reference docs for further information.

Ivy Support in Grails 1.1

With Grails 1.1, Grails features Ivy support out of the box so you don't need the Ivy plugin. Simply using the Ant build.xml and ivy.xml created by Grails' create-app command.

Ivy Support in Grails 1.0 and below

Pre 1.0 Grails shipped Ivy as part of the core and to get started type the following from the root of your project:

grails install-ivy

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"/>
        <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"/>		

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:

grails get-dependencies