ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Malcolm Sparks" <malcolm.spa...@iona.com>
Subject RE: Fixing taskdef (was Re: Feedback on first uses of Ant)
Date Thu, 13 Jul 2000 09:47:07 GMT
> We have been discussing using custom class loader, but I can't
> remember whether we've come to a conclusion - probably not.

Well, IMO you'd need a custom class loader someday, because the taskdefs my
not necessarily be in the system classpath, and the taskdef classes have to
be loaded by the local JVM. You don't have an opportunity to spawn another
VM with a new classpath.

In JDK1.2 the use of class loaders is a little different. Basically, the VM
should try to load the class using the system class loader first, then try
the class loader you specify. The code for loading taskdefs should be
straight forward:

ClassLoader taskdefClassLoader = new ClassLoader() {
  ... (try loading classes from a customizable set of paths- perhaps a
<taskdef> attribute?)
};

Class.forName("org.apache.tools.ant.taskdefs.ATaskdef", true,
taskdefClassLoader);

For JDK1.2 atleast, this functionality would be backwards compatible with
previous versions of Ant.

Just my 2c,

Malcolm

> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@bost.de]
> Sent: 13 July 2000 09:51
> To: ant-dev@jakarta.apache.org
> Subject: Re: Fixing taskdef (was Re: Feedback on first uses of Ant)
>
>
> >>>>> "JH" == Jason Hunter <jhunter@collab.net> writes:
>
>  JH> Any objects to my moving it back?
>
> Yes, this would break taskdefs placed outside of targets - as execute
> will never be called there.
>
> There are other solutions - and we had a discussion about this
> recently.
>
> The first and fastest solution is to use Sam's (undocumented,
> deprecated, experimental, soon to be deleted, you get the idea 8^)
> compiletask task - see source for usage information.
>
> Sometime in the (not too far, I hope) future, task initialization will
> delayed until the task is going to be executed. Throw into that a
> depends attribute on taskdefs (or alternatively allow tasks to be
> executed outside of targets) and the problem could be solved.
>
> We have been discussing using custom class loader, but I can't
> remember whether we've come to a conclusion - probably not.
>
> Stefan
>


Mime
View raw message