2015-08-15 50 views
2

是否有可能讓ant幫助使用目標描述中的屬性值?只是用$ {}符號似乎並沒有工作有沒有辦法在目標描述中展開一個ant屬性?

構建文件:

<property name="test.report.dir"   value="report"/> 
... 
<target name="test" depends="compile.main, compile.test" description="Runs unit tests. Reports are saved in ${test.report.dir}/"> 
... 

終端:

ant -p 

Buildfile: /home/aaron/Projects/DataStore/build.xml 

Main targets: 
... 
test     Runs unit tests. Reports are saved in ${test.report.dir}/ 
... 

這被建議作爲Echo target description in Ant一個解決方案,但作爲一個評論者指出的,它不擴大該財產。

我在Ubuntu上使用ant 1.9.3。

回答

1

不,這是不可能的。目標描述按照原樣讀取:不進行屬性評估。這是有道理的,因爲:

  • 目標描述可望提供有關目標行爲的一般信息,這與某個屬性的值無關。

  • 項目幫助-p選項不執行包含在構建文件中的Ant任務,因此它無法評估使用property任務定義的屬性。

相關問題