ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeroen Breedveld" <jero...@x-hive.com>
Subject FW: Odd behaviour loaderref attribute taskdef and typedef
Date Mon, 06 Jan 2003 10:22:44 GMT
Hi all,

I posted this to the ant-user list but haven't got any reaction sofar.
Since I built custom ant tasks it seems to me that this question can
also be posted here.

regards,

Jeroen Breedveld

Btw, I'm using ant 1.5.1

||  -----Original Message-----
||  From: Jeroen Breedveld [mailto:jeroenb@x-hive.com] 
||  Sent: vrijdag 3 januari 2003 10:53
||  To: ant-user@jakarta.apache.org
||  Subject: 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:   
||  <mailto:ant-user-unsubscribe@jakarta.apache.org>
||  For 
||  additional commands, e-mail: 
||  <mailto:ant-user-help@jakarta.apache.org>
||  


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message