You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Telang, Nandan" <te...@amazon.com> on 2005/12/27 20:55:13 UTC
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
RE: Custom type query
Posted by Rainer Noack <ra...@noacks.net>.
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