You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jeroen Breedveld <je...@x-hive.com> on 2003/01/03 10:52:34 UTC

Odd behaviour loaderref attribute taskdef and typedef

Hi all,

I wrote some custom anttasks for use with the database of our company.
To make sure that the custom tasks and types are loaded with the same
classloader I used the loaderref attribute to supply ant with a
reference to the same classloader. The problem is that when I supply the
loaderref attribute with the same name as the project (see code snippet
below) different classloaders are used to load the custom tasks and
types (that's my conclusion because I receive ClassCastExceptions).
Changing to values of the loaderref attribute to anything else solves
this problem. Is this a bug or did I do something wrong?

regards,

Jeroen Breedveld

code snippet:

<project name="3dm" default="build" basedir=".">

  <target name="init">
    <property file="build.properties"/>
    <path id="classpath">
      <path location="../build"/>
      <fileset dir="${xhive.dir}/build/lib">
        <include name="xhive.jar"/>
        <include name="dom3_intermediate.jar"/>
      </fileset>
      <fileset dir="${xhive.dir}/lib">
        <include name="**/*.jar"/>
      </fileset>
      <fileset dir="../lib">
        <include name="**/*.jar"/>
      </fileset>
    </path>
    <taskdef loaderref="3dm"
              resource="com/xhive/anttasks/tasks.properties"
          classpathref="classpath"/>
    <typedef loaderref="3dm"
              resource="com/xhive/anttasks/type.properties"
          classpathref="classpath"/>
    <database id="MyDatabase"
       bootstrap="${bootstrap}"
            name="${database}"
            user="${user}"
        password="${password}"/>
  </target>

--

X-Hive Corporation
e-mail: jeroenb@x-hive.com
phone: +31 10 7108622
http://www.x-hive.com 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>