title: How do I load optional task sshexec into Ant in a no-configuration manner?
body: <p>I am using sshexec, which depends on jsch-0.1.48.jar. I can't just put that into the ant/lib directory because other users wishing to use the same build script will have to make a configuration on their machine before they can do so. </p>
  
  <p>What I want to do is to be able to reference jsch-0.1.48.jar as part of the project. Currently, I have it sitting in project/libs directory and I am trying something like:</p>
  
  <pre><code>&lt;property name="lib" location="lib"/&gt;
  
  &lt;taskdef name="sshexec" classname="org.apache.tools.ant.taskdefs.optional.ssh.SSHExec"&gt;
    &lt;classpath&gt;
      &lt;pathelement location="${lib}/jsch-0.1.48.jar"/&gt;  
    &lt;/classpath&gt;
  &lt;/taskdef&gt; 
  
  &lt;target name="sshcmd" description="ssh command"&gt;    
      &lt;sshexec host="X.X.X.X" username="USER" password="PASS" command="cmd" trust="true"/&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>But that's not working:</p>
  
  <pre><code>C:\dev\trunk\project:&gt;ant sshcmd
  Buildfile: C:\dev\trunk\project\build.xml
  
  BUILD FAILED
  C:\dev\trunk\project\build.xml:275: taskdef A class needed by class org.apache.tools.ant.taskdefs.optional.ssh.SSHExec cannot be found: com/jcraft/jsch/Logger
  using the classloader AntClassLoader[C:\dev\trunk\project\lib\jsch-0.1.48.jar]
  
  Total time: 0 seconds
  </code></pre>