ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rainer Noack" <rai...@noacks.net>
Subject RE: Custom type query
Date Tue, 27 Dec 2005 20:37:50 GMT
Not really sure what you mean...

Take a look at http://ant.apache.org/manual/index.html -> Developing with
Ant

I often use this pretty simple pattern:

import java.util.Properties;
import org.apache.tools.ant.types.Parameter;

public class MyTask {

    private Properties properties = new Properties();

    // using a predefined type
    public void addConfiguredTaskProperty(Parameter parameter) {
        properties.put(parameter.getName(), parameter.getValue());
    }

    public void execute() {
        ...
    }
}

And it can be parameterized in your buildfile via:

<project ...>
 <target ...>
  <mytask>
       <taskproperty name="foo[1].a" value="FOO"/>
       <taskproperty name="foo[1].b" value="BAR"/>
  </mytask>
 </target>
</project>

Cheers

Rainer

> -----Original Message-----
> From: Telang, Nandan [mailto:telang@amazon.com] 
> Sent: Tuesday, December 27, 2005 8:55 PM
> To: user@ant.apache.org
> Subject: Custom type query
> 
> 
> 
> I wish to pass an array of a properties ( foo[1].a =.. 
> foo[1].b =.. ) to a custom ANT task that I have defined .. 
> What is the best way to do this ? 
> How do I define custom types and can they be passed as 
> attributes of the custom task ?
> 
> Thanks,
> -Nandan
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message