After getting my new Mac, I started using Ant as usual without thinking much of it, until it occurred to me that I never installed, it was there already! Shame the default installation is flawed.
OS X Leopard default Ant installation
Under OS X Leopard, Ant sits at /usr/share/ant/. Whatever, the ant core tasks seem to run ok, it doesn’t make any difference to me. But when I tried to run an optional task, namely the ant FTP task, I got an error message:
Problem: failed to create task or type ftp
Cause: the class org.apache.tools.ant.taskdefs.optional.net.FTP was not found.
This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
-/usr/share/ant/lib
~/.ant/lib
-a directory added on the command line with the -lib argument
Do not panic, this is a common problem.
The commonest cause is a missing JAR.
This is not a bug; it is a configuration problem
That’s when I remembered I hadn’t actually installed Ant myself, so it wouldn’t be set up as I expected.
Installing the Ant FTP task
No big deal, I did the normal thing, i.e. looked up which libraries are needed by Ant, which turned out to be two, Jakarta ORO and Jakarta Commons Net. So I downloaded the latest version of the commons-net package, which at the time of writing is 2.0, extracted it, and copied all the *.jar files to the ant directory:
sudo cp ~/Downloads/commons-net-2.0/*.jar /usr/share/ant/lib
Then did the same again with the ORO library.
After that I run the task again, and… no joy, same error message again. The libraries were there, and yet Ant could not find them.
Re-install Ant on Leopard
To make a long story short, there is something wrong with the Ant installation OS X Leopard came with, the easiest solution is to download the latest version of Ant, and re-install it. It makes sense anyway, as at the time of writing Ant is already one sub-version higher (1.7.1 instead of 1.7.0).
Installing Ant is easy, it is just a matter of copying some .jar files and a bunch of scripts to the /usr/share/ant/ directory.
sudo cp ~/Downloads/apache-ant-1.7.1/bin/* /usr/share/ant/bin
sudo cp ~/Downloads/apache-ant-1.7.1/lib/* /usr/share/ant/lib
I typed the password as required, and was good to go. And this time, everything worked as expected.

Updates
subscribe to this blog's rss feed'
follow me on twitter
subscribe friendfeed
my delicious bookmarks
my youtube channel