ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <>
Subject Re: specifying location of an external library within build.xml
Date Sat, 04 Nov 2006 02:41:41 GMT

Can you add your libraries to ${user.home}/.ant/lib?  That's 
equivalent to adding jars to ${ant.home}/lib.  There is another 
option.  You can avoid all the classloading issues and simply use a 
native SCP executable.  Do something like this...

                 <exec dir="." executable="${scp}" failonerror="true">
                     <arg path="${localfile}"/>
                     <arg value="${serverurl}"/>

...where ${scp} is the name of the SCP executable that is on the 
system Path.  You can parameterize this by loading a 
${user.home}/ file in your build.  So, no matter what 
system you are on and no matter what the name of the SCP executable 
is, it will work as long as the user configures it in that common 
property file.


At 05:45 PM 11/3/2006, you wrote:
 >Hello All,
 >Is there a way to specify the location of an external library for an
 >optional task (jsch.jar in my case) from within build.xml, or to change the
 >order of classes being loaded?
 >Here's what I'm trying to do:
 >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 works fine with Ant 1.5: build.xml checks for current ant
 >version and if it is 1.5 it does <taskdef name="scp"> with custom classpath
 >containing ant-jsch.jar (from 1.6), jsch.jar, etc.
 >Class loaded from ant loader
 >Finding class com.jcraft.jsch.UserInfo
 >Class com.jcraft.jsch.UserInfo loaded from ant loader
 >However, the same build fails with Ant 1.6, with or without <taskdef>:
 >Class loaded from parent
 >loader (parentFirst)
 >A class needed by class
 > be found:
 >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. Unfortunately, currently it only runs with Ant 1.5 and
 >not 1.6.
 >Thanks in advance!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message