ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <>
Subject Re: [DISC] details of task library concept
Date Wed, 23 May 2001 13:36:52 GMT
> How do you find the classes used in your task's code. Today there are
> of tasks that make calls or inherit from the classes of other tasks:
> uses the code from <exec> when fork="yes". And plenty more examples.
> is no reason to forbid a task developer from calling in their tasks,
> tasks provided in other libraries. You will have to be able to especify
> where these other classes are when you load the classes for the new task,
> and not when you configure the task.

Jose, I believe that many of these needs will be met by providing java and
external command execution *services* within the core. In other words I
don't think a task should have to create another task to get at these
services. The practice in Ant-1 of casting the result of
Project.createTask() to specific task types is plainly dangerous in the
face of the user's ability to redefine the tasks.

If you were to be able to create Tasks at will, and I'm not sure that will
be the case in Ant-2*, then I believe you should use the same contract the
Ant core must use in dealing with such tasks - the Task interface (and
reflection).You should not cast to a particular subclass. If you adhere to
these rules, then you should be able to manipulate other tasks regardless
of what classloader has been used to load them since the Task interface
itself will come though the loader used to load the Ant core.

If you choose to subclass another task, then that is OK, it just means that
the base class will be loaded twice, once of its own task in its
classloader and once in you task's classloader. The core will not consider
them to be the same class and nor should you.


Your ability to create a task in Ant-2 will require that class to be
initialized with a TaskContext and it may be that a Task itself does not
have sufficient information to create such a context.

View raw message