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"> ?
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
精彩评论