2011-03-04 58 views
1

我必須通過Apache config.xml配置IPV6。我通過ADDR6讀取IP。我想把它傳遞給像這樣的命令- ant -f config.xml configureForIPv6 <IP>。目標很容易通過,但我如何通過IP的論點? Ant不喜歡參數值。帶有參數的Ant任務

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

回答

2

有兩種方法你可能set properties from the command line

首先,對於任何Java應用程序,使用-D定義屬性:

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

其次,把值(或值)在Java屬性文件(比如被稱爲 'SETTINGS.TXT'),內容可能是:

ADDR=<IP> 

然後使用Ant -propertyfile選項讀取該文件,如:

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

當我使用'-propertyfile = value'時,ant抱怨說:「使用-propertyfile參數時,必須指定一個屬性文件名」。我不得不使用'-propertyfile值' – 2011-11-09 17:21:49

+0

@GregK - 的確 - 感謝並修復。 – 2011-11-09 17:29:13

+0

馬丁謝謝,我知道它運行如下所示; 通過將其設置在我的文件本身中繼承該屬性 謝謝Praveen – Zack 2012-03-26 11:46:55