We all want to use ANT so chances are that you'll use the SCP task at some point. Now what you may not know is that this task relies upon the Java Secure Channel library, referred to as jsch, created by JCraft. In ANT 1.7.0 (latest release as of this writing) it recommends to use version 0.1.29 of jsch, but the latest from JCraft is 0.1.36. Here is how to tell ANT to use a different version:
cd to $ANT_HOME/lib
Edit jsch.version=0.1.29 to read jsch.version=0.1.36
Make sure the jsch jar in $ANT_HOME/lib stays named jsch-0.1.36.jar
Voila! Now the SCP task can be used since you satisfied its only dependency. Will that work? Well sorta, if you don't mind the SCP task hanging. To see more verbose output, as the scp task is executing, make sure you add verbose="true" to the tag.
Don't fret, this is a known bug. See this ant buzilla issue for reference. This issue relates to a missing out.flush(); in the ScpToMessage class when copying directories to a remote host.
A simple fix! Hope at last!
Just get the Source Distribution of ANT and modify the file src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java. You will need to add out.flush(); after line 211. Lines 209 - 213 will look as follows:
sendDirectory(directory, in, out);
Now build ant and move the new ant-jsch.jar to $ANT_HOME/lib and you will be all set.
No more hanging! Enjoy!