Monday, July 30, 2012

Adding ANT SCP task support to Mac OS X

My ANT build script for a web application I’m working on is using the SCP task to use a secure shell copy from my local system to the remote server. After upgrading to Mac OS X 10.7 “Lion” and Mac OS X 10.8 “Mountain Lion” I lost my ability to use this task. I found this post comment by a member of the ANT team that pointed out that when Apple compiled the version of ANT in Mac OS X they didn’t include the optional JAR files needed for additional tasks. This means that, for me, the baked in version of ANT is missing ant-jsch.jar

To restore this functionality, first I opened a Terminal prompt (I use iTerm2, then determined the version of ANT installed on my version of Mac OS X by typing ant -version. On Mac OS X 10.8 “Mountain Lion” it reported that I was using Apache Ant(TM) version 1.8.2 compiled on June 20 2012.

Next I downloaded from the Apache ANT website the 1.8.2 binary distribution of ANT located at After the download completed I extracted the archive and found the file ant-jsch.jar that I needed.

To determine the correct path to place this file, I executed ant -diagnostics | grep ant.home to find the path, which for me was ant.home: /usr/share/ant. I then copied the ant-jsch.jar file to the /usr/share/ant/lib directory.

I now needed the actual JSch JAR file that has the tasks. I was able to download the file jsch–0.1.48.jar from I created a directory to store this in my root by using the mkdir -p ~/.ant/lib command and copying the jsch-0.1.48.jar file to that ~/.ant/lib location.

Now I’m able to use the scp task in my ANT build files, yea!

Without this I would continue to receive the message "Not Available (the implementation class is not present)"


Anonymous said...

Thanks for posting this. Always a good reminder that I need to spend more time getting to know my Mac OSX

Anonymous said...

Thank you for helping me :)

Anonymous said...

Thank you for nice posting