To work through the tutorial, we require Apache Ivy, Ant and IvyDE, and this chapter covers installation of software.
Software | Version | Size (approximate) |
---|---|---|
Apache Ivy | 2.2 | 1 MB |
Apache Ant | 1.8.2 | 8 MB |
IvyDE Eclipse Plugin | 8 MB |
Apache Ant and Apache Ivy Installation
We require Apache Ant and Apache Ivy to work through the tutorial.
Download latest distribution of Apache Ivy and Ant from Apache site. In
case Ant is already installed in your system, ignore the its
installation commands. Following commands installs Apache Ant at
/opt/ant
, but any other location is perfectly fine. Adjust settings
accordingly.
tar -C /opt/ant/ -xzvf apache-ant-1.8.2-bin.tar.gz
tar -xzvf apache-ivy-2.2.0-bin-with-deps.tar.gz
cp apache-ivy-2.2.0/ivy-2.2.0.jar /opt/ant/apache-ant-1.8.2/lib
export ANT_HOME=/opt/ant/apache-ant-1.8.2
export PATH=$PATH:$ANT_HOME/bin
Environment variables ANT_HOME and PATH are essential to run Ant. These
exports may be moved to .bash_profile
in Linux so that they are always
set when you login.
Work Dir
Throughout the tutorial, we use a work directory to run Apache Ivy examples, This directory is some location like $HOME/work, but you are free to choose any other location. We will be using phrases like “create a file in work dir”, “add a ivy.xml to workdir” and “run from work dir” etc., which simply means do that in the work directory.
Test the Apache Ivy installation
To test the Ant and Apache Ivy installation, add following build.xml file to work dir.
build.xml
<project name="test ivy" default="test" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="test" description="Test ivy installation">
<ivy:settings />
</target>
</project>
and run Ant.
ant
Successful build indicates that ant and ivy installation is fine.
Build Error
Typical error installation error is
build.xml:5: Problem: failed to create task or type antlib:org.apache.ivy.ant:settings
check the following to resolve this
environment variable ANT_HOME is not set properly
ivy.jar is missing from ANT_HOME/lib
Install IvyDE Eclipse Plugin
IvyDE Plugin for Eclipse integrates Apache Ivy with Eclipse IDE. From IvyDE Plugin for Eclipse onwards we use the IvyDE plugin to enable dependency management of Eclipse projects. Install IvyDE using one of the following installation methods.
Update Site : To install IvyDE, start Eclipse and go to Help → Install New Software … and it displays the Available Softwares window. In Work with text box, enter IvyDE update site http://www.apache.org/dist/ant/ivyde/updatesite/ and click Add and then in Add Repository window click OK. It displays the following plugins.
Apache Ivy library
Apache IvyDE Eclipse plugin
Select both and proceed. This will install Apache Ivy, Ivy Ant Tasks and IvyDE.
Manual Installation : This method involves the installation of two plugins - IvyDE and Apache Ivy plugins.
IvyDE Plugin : This plugin links core Ivy to Eclipse. Download the IvyDE plugin from https://ant.apache.org/ivy/ivyde/download.html. For Eclipse Indigo download apache-ivyde- 2.1.0.201008101807-RELEASE.tar.gz and uncompress. to get two folders containing the artifacts to deploy. Copy the plugin and features to Eclipse installation directory as follows:
plugins/org.apache.ivyde.eclipse_2.1.0.201008101807-RELEASE.jar to $ECLIPSE_HOME/plugins
features/org.apache.ivyde.feature_2.1.0.201008101807-RELEASE.jar to $ECLIPSE_HOME/features
Apache Ivy Plugin : This plugin contains core Apache Ivy and Ant Tasks. Get the latest Ivy feature and plugin from following sites
For Eclipse Indigo download and copy them to your eclipse installation directory as follows
org.apache.ivy_2.2.0.final_20100923230623.jar to $ECLIPSE_HOME/plugin
org.apache.ivy.eclipse.ant_2.2.0.final_20100923230623.jar to $ECLIPSE_HOME/plugin
org.apache.ivy.feature_2.2.0.final_20100923230623.jar to $ECLIPSE_HOME/features
After installation, restart Eclipse and menu bar should show the Resolve button of IvyDE.
With these installations we are ready to Automate the dependency management with Apache Ivy.