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 Fri, 12 Dec 2008 05:32:41 GMT

Hi Stefan,

Thank you the code changes. I shall go with the changed code.

However Stefan, not able to convince on why this can't be done
automatically, as it is so obvious that  new Copy Object is created while
wring the cutom tag extentions to ant. This code are used with in project
context and it gets invoked though custom xml  tags only in build file only.

I understand of explicit initialisation, if used as libarary in normal java


Stefan Bodewig wrote:
> 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()));
> 	c.setIncludeEmptyDirs(false);
> 	c.setFailOnError(true);
> 	c.setOverwrite(false);
> 	c.setFlatten(false);
> 	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.
> 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