ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Pracht <bpra...@nc.rr.com>
Subject Re: Problem using cpptasks library outside of ant's lib directory
Date Tue, 01 Jun 2004 22:47:18 GMT
Thanks, I changed the build to
     <path id="cc.cp">
         <pathelement 
location="${CPPTASKS_HOME}/build/lib/cpptasks.jar"/>
     </path>

and I changed the task/typedef's accordingly.
     <taskdef name="cc" classname="net.sf.antcontrib.cpptasks.CCTask" 
loaderref="cc.loaderRef" classpathref="cc.cp"/>
     <typedef name="linker" 
classname="net.sf.antcontrib.cpptasks.LinkerDef" 
loaderref="cc.loaderRef" classpathref="cc.cp"/>

It took me a while to figure out that loaderref is something
that's picked at random.  I wish someone documented that.

Thanks,
Ben Pracht
Dominique Devienne wrote:

>>From: Ben Pracht [mailto:bpracht@nc.rr.com]
>>
>>I'm trying to use cpptasks using the jar file outside
>>the ant\lib directory.  Unfortunately, it keeps saying this:
>>
>>C:\SoftCopyReader\current\build.xml:850: Referenced object
>>base-msvc-compiler not correct type, is
>>net.sf.antcontrib.cpptasks.CompilerDef should be
>>net.sf.antcontrib.cpptasks.CompilerDef
>>
>>So my question:
>>What does Ant or cpptasks want from me?
> 
> 
> Each <taskdef>/<typedef> with an explicit classpath will use a new
> ClassLoader unless explicitly specified to use the same ClassLoader (using
> the loaderref attribute). So define a single classpath for CppTasks, and use
> it for defining CppTasks' types/tasks. Something like:
> 
> <path id="cc.cp">
>   <pathelement location="${CPPTASKS_HOME}/build/lib/cpptasks.jar"/>
> </classpath>
> 
> <taskdef resource="cpptasks.tasks" loaderref="cc.loader">
>   <classpath refid="cc.cp"/>
> </taskdef>
> <typedef resource="cpptasks.types" loaderref="cc.loader">
>   <classpath refid="cc.cp"/>
> </typedef>
> 
> --DD
> 
> PS: Or save you the trouble, and put cpptasks.jar in ant/lib,
>     or with Ant 1.6+, do -lib ${CPPTASKS_HOME}/build/lib on the
>     command line




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message