ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: Include nested arg elements in my custom task
Date Thu, 01 Jul 2004 05:17:20 GMT
> <target name="main">
>    <mytask>
>      <arg line="foo">
>      <arg line="bar">
>    </mytask>
> </target>
> 
> I understand this means I need an add method in my Task subclass:
>      public void add(Arg arg) {}
> What class matches <arg> elements?

Depends on the <arg> you want to have :-)
If I want to reuse existing tasks/datatypes I search for an existing task
using that. In this case <exec> uses a nested <arg>.

oata/taskdefs/default.properties:
exec=org.apache.tools.ant.taskdefs.ExecTask
ExecTask:027: import org.apache.tools.ant.types.Commandline;
ExecTask:287:     public Commandline.Argument createArg() {
ExecTask:288:        return cmdl.createArgument();
ExecTask:289:     }


> Within this add method, can I just get the arg value or is 
> there something 
> else related to Ant that needs to be done?

Have you read
  Manual "Writing Your Own Task"
  http://ant.apache.org/manual/develop.html#writingowntask

  Manual "Tutorial: Writing Tasks"
  http://ant.apache.org/manual/tutorial-writing-tasks.html#NestedElements


Jan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message