[Webtest] Custom tasks: take care at loaderRef

Marc Guillemot webtest@lists.canoo.com
Thu, 24 Jul 2003 18:11:08 +0200


I've just won an hard battle against ant to make my custom tasks working.
Maybe the results could interest someone (or get integrated in the
Troubleshooting page).

I got each time the error like:

file:E:/EWorkspace/Junetz/web-app/WEB-INF/src/webtests/build.xml:58: Task
must be of type "Step": zkystorexpath at
tom.xml:25:  is of type org.apache.tools.ant.UnknownElement

although my tasks extend Step.

The cause of the problem was the class loader: my tasks had to be loaded
with the same class loader as the canoo tasks.

Now my definitions look like this (and this works perfect):

<path id="webtests.classpath">
   <fileset dir="${webtests.canoohome}" includes="**/lib/*.jar"/>
   <pathelement path="${myWebtestTasks}"/>

<taskdef file="${webtests.canoohome}/webtestTaskdefs.properties"
loaderRef="toto" classpathref="webtests.classpath"/>

loaderRef="toto" classpathref="webtests.classpath"/>