ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raja Nagendra Kumar <>
Subject Re: FileSet with copy fails with NPE..
Date Thu, 11 Dec 2008 08:28:28 GMT

Thank you Stefan for providing the insites..

I complete see the point related to 
> <ant> tasks and maybe even <parallel>.

Based on lifecycle link you provided I see that there is a mention of 
> The task gets references to its project and location inside the buildfile
> via its inherited project and location variables. 

In such cases, why should the user initialise them explicitly, when run from
build file.

Pl. suggest any other better approach, so that, when the user does not
explicitly intialise the task, it could take parents project and other info
related to parent.

If you could provide me details on the classes to look for this, I shall try
providing fix based on that understanding.

Raja Nagendra Kumar,

Stefan Bodewig wrote:
> On 2008-12-11, Raja Nagendra Kumar <> wrote:
>> Pl. find the fix for the same in ProjectComponent
>> We are defining a GOBAL_DEFAULT_PROJECT which would be same as the first
>> non
>> null setProject call parameter.
> That would be a pretty bad idea, in particular in the presence of
> <ant> tasks and maybe even <parallel>.
> Generally Ant's API is not designed to be used in an embedded way and
> if you create any sort of task programatically you better make sure it
> is initialized properly, which includes setting the project instance.
> If you create a task programatically, make sure you implement the full
> lifecycles as defined
> <> because the
> existing task will depend on it.
> I don't see you method setting the location, owning target or invoking
> init() either, which might get you in trouble as well.
> You may want to use Task.bindToOwner() to copy the most important
> properties from your current task to the manualy created copy task but
> should still invoke init() (some tasks use it, Copy does not).
> Stefan
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View this message in context:
Sent from the Ant - Dev mailing list archive at

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

View raw message