#1 Option To Prefix Classpath

open
nobody
None
5
2012-04-16
2012-04-16
JohnnyBoy
No

It took me quite a while to work out how to fix an issue where I had ant-contrib-1.0b2.jar in the project and other people had ant-contrib-1.0b3.jar in the ant lib.
FYI ant-contrib-1.0b2.jar is required because antfetch doesn't work in ant-contrib-1.0b3.jar.

I couldn't work out how to prefix ant-contrib-1.0b2.jar to the system classpath to get around this so I had to create a new classloader.
All the info about how to do this is on the doc page (http://enitsys.sourceforge.net/ant-classloadertask/), however, it is spread out in different places and more examples (such as below) would have made this easier.

Can you add a prefix to classpath option and/or update the documentation with an example like this please.

Thanks

<!--Append the dependent jars to the classpath so we don't have to install them in the ant directory-->
<taskdef resource="net/jtools/classloadertask/antlib.xml"
classpath="${deploy.dir}/ftpant/ant-classloadertask.jar"/>

<classloader loader="ant.contrib.loader" parentloader="project">
<classpath>
<pathelement location="${deploy.dir}/ftpant/ant-contrib-1.0b2.jar"/>
<pathelement location="${deploy.dir}/ftpant/jsch-0.1.42.jar"/>
<pathelement location="${deploy.dir}/ant-classloadertask.jar"/>
</classpath>
<antparameters parentfirst="false"/>
<handler loader="org.apache.tools.ant.AntClassLoader" adapter="org.apache.tools.ant.taskdefs.classloader.adapter.AntClassLoaderAdapter"/>
</classloader>

<taskdef resource="net/sf/antcontrib/antcontrib.properties"
classpath="${deploy.dir}/ftpant/ant-contrib-1.0b2.jar"
loaderref="ant.contrib.loader"/>

Discussion