Zack
Zack

Reputation: 117

Ant task with argument

I have to configure IPV6 through Apache config.xml. I read the IP through ADDR6. I want to pass it to the command like this - ant -f config.xml configureForIPv6 <IP>. The target is easy to pass, but how do i pass the argument for IP? Ant does not like the arg value.

<ant antfile="${APACHE_HOME}/config.xml" target="configureForIPv6" arg="-DIPv6_Interface=${ADDR6}" inheritRefs="true"> ?

Upvotes: 1

Views: 905

Answers (1)

martin clayton
martin clayton

Reputation: 78105

There are two ways you might set properties from the command line.

First, as for any Java application, use -D to define the property:

ant -f config.xml configureForIPv6 -DADDR=<IP>

Second, put the value (or values) in a Java property file (say called 'settings.txt'), content might be:

ADDR=<IP>

then read the file using the Ant -propertyfile option, e.g.:

ant -f config.xml configureForIPv6 -propertyfile settings.txt

Upvotes: 2

Related Questions