You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Leo Sutic <le...@inspireinfrastructure.com> on 2002/09/16 13:04:55 UTC

Using tasks in composition

I was adviced to use composition rather than inheritance when 
extending the existng tasks in Ant. Basically, instead of extending
the Ant class, create an instance of it and use it in my own
task that inherits directly from Task.

The problem is that the initialization process is not done by the
createTask method in Project.

Is there a helper class for this?

/LS


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


Re: Using tasks in composition

Posted by Peter Donald <pe...@apache.org>.
On Mon, 16 Sep 2002 21:04, Leo Sutic wrote:
> I was adviced to use composition rather than inheritance when
> extending the existng tasks in Ant. Basically, instead of extending
> the Ant class, create an instance of it and use it in my own
> task that inherits directly from Task.
>
> The problem is that the initialization process is not done by the
> createTask method in Project.
>
> Is there a helper class for this?

Unfortunetly not. And even if there was, Ant does not guarentee any sort of 
API compatability anyways. We try to remain compatible at the XML 
representation level but it is not uncommon for the underlying code to 
change. 

So if you go this path you need to be willing to nag ant when they break 
something or accept the potential upgrades every release.


-- 
Cheers,

Peter Donald
*-----------------------------------------------------*
| Never argue with an idiot, they'll drag you down to |
| their level, and beat you with experience           |
*-----------------------------------------------------* 


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