build.xml contains <scp> and <sshexec> tasks, so I provide jsch.jar and
other libraries in the same directory together with build.xml.
The following taskdef:
<taskdef name="scp"
classname="org.apache.tools.ant.taskdefs.optional.ssh.Scp"
classpath="WebContent/WEB-INF/lib/jsch-0.1.43.jar" />
throws an error
A class needed by class org.apache.tools.ant.taskdefs.optional.ssh.Scp
cannot be found: com/jcraft/jsch/UserInfo
I cannot modify the standard Ant installation (e.g. put jsch.jar in ant lib
directory, or remove ant-jsch.jar), or add command-line flags, or modify
system environment variables, etc.: the script has to run with default Ant
on different systems.
I’m actually reposting the question originally asked here:
http://ant.1045680.n5.nabble.com/specifying-location-of-an-external-library-within-build-xml-td1344969.html
but could not get the answer about classloader to work.
Finally I found a working solution (for Ant 1.7.1 at least). First you have to remove
ant-jsch.jarfromANT_HOME/libas Ant complains about it and gets confused. Then load libraries from the project itself: