You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stefan Bodewig <bo...@bost.de> on 2000/09/18 16:22:51 UTC

dynamic taskdefs

Hi all,

the patch I've just committed should allow tasks to built and used in
the same buildfile. Something like

<target name="buildtask">
  <javac src="src/" dest="dest/" includes="org/example/Task.java" />
  <taskdef name="example" classname="org.example.Task">
    <classpath>
      <pathelement location="dest/" />
    </classpath>
  </taskdef>
</target>

<target name="usetask" depends="buildtask">
  <example ... />
</target>

should work now with one exception (see below). 

As a side effect you can put all kind of well formed XML into your
targets - as long as you don't try to execute those targets of course.
Ant's own build file now includes a <junit> task inside the runtests
target unconditionally - as long as you don't run this target Ant
won't complain even if you didn't install JUnit.

The exception: Dynamic loading of tasks from a classpath other than
the bootstrap class loader fails on JDK 1.1 (only checked with 1.1.7
on Linux) with a NoClassDefFoundError I haven't been able to pin down
yet. Any takers are welcome.

Stefan