1) scp task issue
Problem: failed to create task or type scp
Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.Scp 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/steve/.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.
2) sshexec task issue
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/steve/.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.
I already download the jsch-0.1.44.jar from Jcraft, and copied the jar file into folder /usr/share/ant/lib, and I also tried to put the jar file into different folder as the error suggested, but no help.
Finally I found this article:, it mentioned that in Mac, the ant-jsch.jar is missing!
and when I look at the /usr/share/ant/lib folder, yes there is no ant-jsch.jar file! So I downloaded the ant 1.8.2 from ant website, unpack it, and copy it into the /usr/share/ant/lib folder, it just works!
In summary, to make the ant scp and sshexec task work in Mac, you need to do 2 things:
- Install ant-jsch.jar file: download the ant package from ant website, then copy the ant-jsch.jar into /usr/shar/ant/lib folder
- Go to Jcraft website, download the latest version of jsch jar file, copy it into /usr/share/ant/lib
Thanks for that! After some hours of searching, I finally found the right instructions here.
ReplyDeleteThanks for the tip. FYI if you run ant -diagnostics in the shell and scroll down to the "Tasks availability" section, it will tell you the functions that your version doesn't currently support. On the default Mac install that is a pretty big list.
ReplyDeleteIn this case, for scp and sshexec it shows you:
sshexec : Missing dependency com.jcraft.jsch.Logger
scp : Missing dependency com.jcraft.jsch.Logger
When something doesn't work in ant this is usually the first place I check.