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

FW: Odd behaviour loaderref attribute taskdef and typedef

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:   
||  <ma...@jakarta.apache.org>
||  For 
||  additional commands, e-mail: 
||  <ma...@jakarta.apache.org>
||  


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


Re: FW: Odd behaviour loaderref attribute taskdef and typedef

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Jeroen Breedveld wrote:
> 
> Ok, thanks.
> 


I've committed a change to give you a build exception when you use an 
existing reference which is not a class loader. This is in CVS HEAD (1.6Alpha)

Conor



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


RE: FW: Odd behaviour loaderref attribute taskdef and typedef

Posted by Jeroen Breedveld <je...@x-hive.com>.
||  -----Original Message-----
||  From: Conor MacNeill [mailto:conor@cortexebusiness.com.au] 
||  Sent: maandag 6 januari 2003 13:32
||  To: Ant Developers List
||  Subject: Re: FW: Odd behaviour loaderref attribute taskdef 
||  and typedef
||  
||  Sorry, I'm looking at it and was going to respond on 
||  ant-user. The namespace 
||  used for loaders is the "reference" namespace and a 
||  reference to the project 
||  object is added to this namespace for the project name.
||  
||  I'm going to add some code to make this into an error rather than a 
||  ClassCastException.
||  
||  For now, use distinct names.

Ok, thanks.

regards,

Jeroen Breedveld


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


Re: FW: Odd behaviour loaderref attribute taskdef and typedef

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Jeroen Breedveld wrote:
> 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.
> 

Sorry, I'm looking at it and was going to respond on ant-user. The namespace 
used for loaders is the "reference" namespace and a reference to the project 
object is added to this namespace for the project name.

I'm going to add some code to make this into an error rather than a 
ClassCastException.

For now, use distinct names.

Conor



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