ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: Decrare a property array
Date Mon, 19 May 2008 04:53:03 GMT
> property task would allow decraration of single name and  value.
However I
> would like to have a property which is like java hash map or
> double array. Is there a direct way to have such  properties..(not
looking to
> use groovey or some other script)

As Ant is not a programming language there is no support for that.
As described in
urning-list you can create your own list-syntax and parse that. E.g:
    --> split on ';' for separating the key-value-pairs
    --> then split on '=' for separating the keys from their values

> Also, what is the way to have macro's defined so that it accepts such
> attributes. I am ware of macros which only take attribute which is not
an array.

With the your own syntax you just have a normal property which you can
pass in.
But I would suggest using <scriptdef> instead of <macrodef> as you can
use language split- and loop-functions.

But better would be implementing the task in Java as you can support you
need natively
    <my:replace file="">
        <param search="foo" replace="bar"/>
        <param search="hello" replace="world"/>

    public class ReplaceTask extends Task {
        public void setFile( file) { ... }
        public void add(Param p) { paramList.add(p); }
        class Param {
            public setSearch(String s) { ... }
            public setReplace(String r) { ... }


> I am writing this in the context of writing a macro, which 
> does replacing of
> certain set of key value pairs in a given file.
> Regards,
> Nagendra
> -- 
> View this message in context: 
> Sent from the Ant - Users mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message