Is it possible to create the nested element for any ant task. For e.g.
<copy todir="../backup/dir">
<fileset dir="src_dir"/>
<filterset>
<filter token="TITLE" value="Foo Bar"/>
</filterset>
</copy>
Here for the task copy we are having nested element as filterset. Now, i would like to create my own nested element encryptfilterset for the task copy.
<copy todir="../backup/dir">
<fileset dir="src_dir"/>
<encryptfilterset>
<filter token="TITLE" value="Foo Bar"/>
</encryptfilterset>
</copy>
How can we do that?
we have to extend the existing task to create
CustomTask
and now to support the custom nested element XYZ create a method in your new classpublic XYZ createXYZ();
or
public void addXYZ(XYZ obj)
or
public void addXYZ(XYZ obj)
So my files looked like:-
build.xml
You can create your own macrodef
(this is just an example)
I would play around with macrodef there are a few examples out there
http://ant.apache.org/manual/Tasks/macrodef.html