views:

1373

answers:

2

I need to copy a war file via scp.

I have added the jsch-0.1.42.jar to $ANT_HOME/lib but I'm still getting this error:

Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.Scp was not found. This looks like one of Ant's optional components.

This is the result of running ant -diagnostics just in case:

http://gist.github.com/320859

A: 

You might try one of the other ways to make optional tasks available. I see ant wants "jsch.jar 0.1.42 or later"; it may be giving up after finding jsch-0.1.29.jar. Finally, verify that whatever invokes ant uses the version in $ANT_HOME. On my platform, /usr/share/ant is a link, and the IDEs each bring their own. They're mostly the same version, but in different places.

trashgod
+1  A: 

This looks like your problem, from the top of the diagnostics:

optional tasks : not available

Your $ANT_HOME/lib directory is missing ant-jsch.jar, which is where your missing class comes from.

I'm not sure how this happened - I always install Ant from the ZIP file on the download site, which includes all the optional tasks. If you installed Ant from a Linux package, try checking to see if there is a separate package for the optional tasks.

Once you get the optional tasks installed, I would delete the old version of jsch.jar as @trashgod suggests.

gareth_bowles
That solved it. Thanks
Pablo Fernandez