ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: FileSet with copy fails with NPE..
Date Fri, 12 Dec 2008 05:20:01 GMT
On 2008-12-11, Raja Nagendra Kumar <> wrote:

> 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.

Because Ant can only intialize task it creates itself.

> 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.

That would be the wrong approach.  The user is responsible for
lifecycle handling when he creates tasks manually IMHO.  If your
method was changed to read

private final Copy createCopyTask()
	final Copy c = new Copy();
+       c.bindToOwner(this);
+       c.init();
	c.setTodir(new File(getDestdir().getPath()));
	return c;

things should work as expected.

Ant really is not a general purpose API, if we wanted to make it one,
we'd have bigger problems than providing default project instances.
We shouldn't pretend it is one.


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

View raw message