Bookmark this site!

2009-02-16

ant ftp task libraries:
jakarta-oro; commons-net

A problem

Update: 6 April 2012 This stopped working again. Adding ant-commons-net-1.7.1.jar to ~/.ant/lib resolved the problem.

My installed version of ant (I presume from Developer Tools) doesn't support the ftp task:

$ which ant
/usr/bin/ant
$ ant -version
Apache Ant version 1.7.0 compiled on August 25 2008
$ ant -diagnostics | grep ftp.*Available
ftp : Not Available (the implementation class is not present)
$

The manual says To use the FTP task, you need jakarta-oro 2.0.8 or later, and commons-net

Sounds simple—just find the right .jar files and put them in ~/.ant/lib

jakarta-oro-2.0.8.jar is easy to find.

commons-net-2.0.jar is also easy to find, as is commons-net-ftp-2.0.jar —but they don't work. For example:

$ ls ~/.ant/lib
commons-net-2.0.jar jakarta-oro-2.0.8.jar
$ /usr/bin/ant -diagnostics | grep ftp.*Avail
ftp : Not Available (the implementation class is not present)
$

ant-commons-net-1.7.1.jar does work with Ant version 1.7.0 — and you can find it if you look.

But there is an easier way...

The solution

Update to Ant version 1.7.1 (I did this from MacPorts with Porticus; Fink also has this version):

$ which ant
/opt/local/bin/ant
$ ant -version
Apache Ant version 1.7.1 compiled on June 27 2008
$ant -diagnostics | grep ftp.*Available
$ ls ~/.ant/lib
$

The MacPorts installation includes the requisite java archives. (I haven't tested the Fink install.)