java - Ant taskdef - requires both classpath and -lib parameter? -


whilst working on ant script today noticed though classpath defined classpath attribute, still needed use -lib when starting ant (ie ant -lib myjar.jar) make run properly.

<project name="my project" default="run-task" basedir=".">   <target name="run-task" description="use ant task">     <taskdef name="taskname" classname="mypackage.myclass" classpath="myjar.jar"/>     <taskname />   </target> </project> 

is there quirk in classloading ant requires this?

the following should work same.

<path id="ant.tasks">    <fileset dir="lib" includes="myspecialant.jar"/> </path>  <taskdef name="taskname" classname="mypackage.myclass" classpathref="ant.tasks"/> 

i prefer manage classpaths @ top of build separate logic uses them. make troubleshooting simpler.


Comments