Adding optional tasks to Apache Ant
Ant provides many tasks out of the box but some have to be added separately. This document explains how to do it.
For information on how to install Ant itself see Installing Apache Ant on Debian Linux .

Why optional tasks?
Because optional tasks are provided by third party software, and many require additional libraries.
For most jobs Ant without optional tasks works fine. However there are some extra tasks that are very useful (e.g. scp ).

Install optional tasks
I'm assuming you installed Ant in /opt/ant/apache-ant-[version] directory and created a default symlink pointing to it.
Open a terminal and go there. You need to login as root .

If you're using Gnome desktop open Root Terminal window ( Applications/Accessories/Root Terminal ).
Otherwise just open a terminal and login as root .
Press ENTER after each command.

cd /opt/ant/default
ant -f fetch.xml -Ddest=system

You should see a message saying:

Downloading to /opt/ant/apache-ant-1.8.4/lib

Followed by many log messages.
Last message should say something like:

BUILD SUCCESSFUL
Total time: 1 minute 45 seconds

You should now have access to optional Ant tasks.

Example of optional task (scp)
If you want to deploy files to remote host accessible by ssh you can use scp task to do that.
Add one of the lines below to your Ant script (e.g. build.xml ):

If you know user name and password for remote host:

<scp todir="userName@remoteHost:remoteDir" file="fileName" passphrase="secret" />

If your account has a public key registered with remote host and your ssh user name is the same as your login name:

<scp todir="${user.name}@remoteHost:remoteDir" file="${fileName}" keyfile="${user.home}/.ssh/id_rsa" />

${fileName} is an Ant property holding file name of the file you want to copy.

What if scp task does not work?
You can always call scp directly. Add this to your Ant script:

<exec executable="scp">
    <arg value="${fileName}" />
    <arg value="${user.name}@remoteHost:remoteDir" />
</exec>

Again script above assumes your account has a public key registered with remote host.