ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <>
Subject Re: Quick question about creating nested elements
Date Mon, 12 Feb 2001 13:14:02 GMT
At 07:20  9/02/01 -0800, you wrote:
>Is there any way to create a nested element at runtime without knowing what
>the element name was?  I have written a few tasks, which use the
>'createXXXX()' syntax for creating a nested element, but I would like to be
>able to create any type of nested element, by something like this:
> public Object create(String type) {
>   return project.createTask(type);
> }
>or something like that, so I could then write my build.xml:
> <mytask>
>   <javac...>
>   <jar...>
>   <whatever...>
> </mytask>
>without having to have createJavac(), createJar(), createWhatever() methods
>on mytask.  Is there any way to do this currently?  If not where would I
>look to add it?

It is a nice feature in a small proportion of tasks. (ie control structures
- if/then/else/while/parralel) The concept of container tasks has come up a
number of times (A few days ago was latest). In Ant2.0 it will be quite
possible but at the moment it is not possible in Ant1.x. There was patches
to enable it. The main problem with supporting it in Ant1.x is that the
mechanism will change in Ant2.0 in a non-backward compatable manner.

View raw message