There are two main ways to install Ivy, either by hand or by automatic installation.
1) Manual Installation
Download the version you want from here, undo the downloaded zip file wherever you want, and copy the Ivy jar file to your ANT lib directory (ant_home/lib).
If you use ant 1.6.0 or higher, you can simply go to the Src/example/hello-ivy directory and run Ant: If the build succeeds, you successfully install the ivy!
If you use ant1.5.1 or higher, you have to modify the build file inside the example.
-Add task definitions for Ivy tasks:
<taskdef name="ivy-configure" classname="org.apache.ivy.ant.IvyConfigure"/>
<taskdef name="ivy-resolve" classname="org.apache.ivy.ant.IvyResolve"/>
<taskdef name="ivy-retrieve" classname="org.apache.ivy.ant.IvyRetrieve"/>
<taskdef name="ivy-publish" classname="org.apache.ivy.ant.IvyPublish"/>
-Replace the IVY:XXX task with the Ivy-xxx
You can now run build, and if built successfully, you will successfully install the ivy!
If the build does not succeed, check the FAQ to see what the problem is with the IVYREP parser.
Ivy Dependence
One of the two binary versions of Ivy does not contain an optional dependency. To download them by using Ivy, all you need to do is run the ant build file that is provided in the distribution package. This will use Ivy herself to download dependencies. You can then see the Ivy Optional dependencies that are organized according to the configuration in Ivy's Lib directory (refer to Ivy.xml for details of configuration).
2) Automatic Installation
If you want to use Ivy in your ant build script only and have an Internet connection when you build it, you can download ivy from the automatic site and use the downloaded version to use this simple build fragment:
<property name= "ivy.install.version" value= "2.0.0-beta1"/>
<condition property= "Ivy.home" value= "${env". Ivy_home} ">
<isset property= "env. Ivy_home "/>
</condition>
<property name= "Ivy.home" value= "${user.home}/.ant"/>
<property name= "Ivy.jar.dir" value= "${ivy.home}/lib"/>
<property name= "Ivy.jar.file" value= "${ivy.jar.dir}/ivy.jar"/>
<target name= "Download-ivy" unless= "Offline" >
<mkdir dir= "${ivy.jar.dir}"/>
<!--download Ivy from web site So, it can be used even without any special installation->
<get src= "Http://www.apache.org/dist/ant/ivy/${ivy.install.version}/ivy.jar"
Dest= "${ivy.jar.file}" usetimestamp= "true"/>
</target>
<target name= "Init-ivy" depends= "Download-ivy" >
<!--try to load Ivy This is from Ivy home, in case the user has not already dropped
It into Ant's lib Dir (note that the latter copy would always take precedence).
We are not fail as long as local lib Dir exists (it may empty) and
Ivy is in least one of Ant's Lib Dir or the local lib dir.-->
<path id= "Ivy.lib.path" >
<fileset dir= "${ivy.jar.dir}" includes= "*.jar"/>
</path>
<taskdef resource= "Org/apache/ivy/ant/antlib.xml"
Uri= "Antlib:org.apache.ivy.ant" classpathref= "Ivy.lib.path"/>
</target>
The only thing you need to do is to increase your target init-ivy dependencies in your use of Ivy's goals and add the Ivy namespace to your build script. For more details on this, see the sample go-ivy that you included.