The distribution of Ant 1.8.2 is broken on Mac.

It turns out that just adding jsch-0.1.45.jar to /usr/share/ant/lib is not enough if you want to use sshexec to execute ssh commands on a remote host. You will still get the error:

BUILD FAILED
/Users/tsu/projects/linkon/fp/sabine/resources/deploy/build.xml:57: Problem: failed to create task or type sshexec
Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.SSHExec 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
        -/Users/tsu/.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

The solution is to download the ant distribution and manually patch it's lib directory with ant-jsch.jar. In my case I added it to /usr/share/ant/lib

This will allow you to use ssh from Ant.

Resources