I was trying to remote copy a war file for deployment to a server,
which can be done using
1. <scp verbose=”true” file=”remote_deployment/file.war” todir=”user:pass@~/jetty/webapps”/>
2. We just need to add a jar to the ANT classpath for this to work available here http://www.jcraft.com/jsch/
the problem I faced was that I was behind a proxy, and there is currently no way of specifiying a proxy for Jsch from a build file. (here is <setproxy /> task but it does not work with Jsch.
The solution : JSch library is a implementation of SSH in pure java, so we modify it to do that
I patched the src/com/jcraft/jsch/JSch.java file to get the environment variable (http_proxy) and use it for initiating a connection through the proxy to the host.
Here is the patched jar file
download it from here
Another point : on most systems http_proxy won’t be available on non login shells.
hence we need to set the environment variable in eclipse,