ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nick Southwell" <>
Subject RE: loaderref attribute in taskdef
Date Wed, 03 Jul 2002 20:35:29 GMT
Thanks for responses, but I'm still stuck.  I think the loaderref is
supposed to refer to an AntClassLoader.  But I don't know where to get one
from.  Making up a name doesn't work.  Here's a snippet of code from the
implementation of Definer (which taskdef uses). 'loaderId' is the value
associated with loaderRef.

        // If a loader has been set ( either by loaderRef or magic
property )
        if (loaderId != null) {
            Object reusedLoader = project.getReference(loaderId);
            if (reusedLoader != null) {
                if (reusedLoader instanceof AntClassLoader) {
                    return (AntClassLoader)reusedLoader;
                // In future the reference object may be the <loader> type
                // if( reusedLoader instanceof Loader ) {
                //      return ((Loader)reusedLoader).getLoader(project);
                // }


-----Original Message-----
From: Diane Holt []
Sent: Wednesday, July 03, 2002 3:05 PM
To: Ant Users List
Subject: RE: loaderref attribute in taskdef

--- Dominique Devienne <> wrote:
> Never used it, but I think you just have to use the same name for the
> loaderref attribute for both your custom tasks to be loaded by the same
> class loader, which is essential for them to recognize each other. --DD

This is what the comment in the code has to say about it:
 * Use the reference to locate the loader. If the loader is not
 * found, taskdef will use the specified classpath and register it
 * with the specified name.
 * This allow multiple taskdef/typedef to use the same class loader,
 * so they can be used together. It eliminate the need to
 * put them in the CLASSPATH.
 * @since Ant 1.5

Which says to me that you're basically assigning the name of the reference
the first time you specify that attribute, then referring to it when you
use it again.



Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message