我如何可以調用基於命令行參數的目標?例如,我想有Apache Ant的 - 使用命令行參數爲目標
ant -Dbits=32 test
呼叫<target name="test-32">
和
ant -Dbits=64 test
呼叫<target name="test-64">
我嘗試這樣做:
ant -Dbits=32 test
:
<target name="test-32">
...
</target>
<target name="test-64">
...
</target>
<target name="test" depends="test-${bits}">
但是,當我運行該腳本
我收到以下錯誤:
Target "test-${bits}" does not exist in the project
爲什麼不'螞蟻test_32'和'螞蟻test_64'? – hmjd
代碼重複。我想分解出通用的代碼。兩個目標之間的唯一區別是單個編譯器標誌。 –
如果它只是一個不同的標誌,你可以在「$ {位}」中的測試目標本身的價值在使用'',而不是單獨的32倍64的目標設置好了。 –