Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Help Installing FTP Task for ANT on OSX

Tags:

macos

ant

ftp

Hey, all. I'm currently trying to set up FTP support for my ANT (version 1.8.2) install on OSX (Snow Leopard 10.6.7) and I've kind of run into a wall. I've read the documentation on Apache.org covering the installation of new tasks as well as several articles littered throughout the web and I can't seem to get this thing working.

All the articles I've read refer to two specific JAR files that does not come packaged with the default installation of ANT:

  1. Commons-Net (2.2.0)
  2. Jakarta ORO (2.0.8)

Apparently, Jakarta ORO is no longer an active Apache project, but I was able to find an archived version.

Then, apparently, all I have to do is drop the precompiled JAR files into the lib folder relative to ANTs base install directory. I ran the following command:

ant -diagnostics | grep ftp.*Available

And I get the following response:

ftp : Not Available (the implementation class is not present)

No joy.

Not sure what else to do. From what I've read, I'm performing the appropriate steps to get this thing working.

So, I've done a few hours of due diligence and I am left with no choice but to ask you all for help. Below is a direct link to the out put of the -diagnostics switch. Hopefully, someone can shed some light on what I'm doing wrong here.

http://www.thedrunkenepic.com/uploads/antDiagnostics.txt

As always, I'm grateful for any help I can get!

DISCLAIMER: I've been using OSX now for the past few months and while I feel pretty comfortable with using the terminal, I'm still relatively new. So, please... be gentle. :)

like image 928
Wilhelm Murdoch Avatar asked Jan 19 '23 23:01

Wilhelm Murdoch


2 Answers

If you don't want to re-install Ant just to add the dependency, you can do this:

  • Download ant-commons-net.jar for the Ant version you have (link is for Ant 1.8.2 which is the Ant included in OS X Lion).
  • Put the jar in ~/.ant/lib/ (create that directory if you don't have it).
  • You're done!
like image 96
Anders Kindberg Avatar answered Jan 30 '23 14:01

Anders Kindberg


The version of ant that comes with OSX doesn't include any of the optional tasks - not just the dependencies (e.g. commons-net), the jar files that implement the tasks themselves aren't there. I think that when compiling ant, those tasks are only built if the dependencies are present on the machine (as they reference them) and the apple engineer (or build machine) that compiled the mac ant version didn't have the dependencies.

For example:

~ $ ls /usr/share/java/ant-1.8.2/lib/ant-commons-net.jar
ls: /usr/share/java/ant-1.8.2/lib/ant-commons-net.jar: No such file or directory

but (I have ant downloaded from Apache installed locally in my ~/tools dir):

~ $ ls tools/apache-ant-1.8.2/lib/ant-commons-net.jar 
tools/apache-ant-1.8.2/lib/ant-commons-net.jar

and:

~ $ jar -tf tools/apache-ant-1.8.2/lib/ant-commons-net.jar | grep FTPTask.class
org/apache/tools/ant/taskdefs/optional/net/FTPTask.class

Your best bet is probably to get a version of ant direct from the Apache site and install it locally somewhere.

like image 41
matt Avatar answered Jan 30 '23 15:01

matt