Ant task with argument

非 Y 不嫁゛ 提交于 2019-12-11 07:35:31

问题


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"> ?

回答1:


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


来源:https://stackoverflow.com/questions/5190399/ant-task-with-argument

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!