2011-11-22 128 views
33

蚂蚁退出任务回声:如何在Ant中输出属性值?

<echo message="Hello, world"/> 

但似乎没用。我需要检查ant文件中的值。 例如

<property file="${user.home}/build.properties"/> 
<echo message="${file}" /> 

但我只收到:

[echo] ${file} 

怎样才可以有文件的蚂蚁显示值?

回答

42

本声明:

<property file="${user.home}/build.properties"/> 

Reads a property file(即所有在该文件属性),并且不设置名为文件财产。

这将是正确的。你先设置一个属性,然后呼应它:

<property name="file" value="${user.home}/build.properties"/> 
<echo message="${file}" /> 
7

你得到${file}你回显,因为你没有设置该属性。您的财产文件中是否有一行表示file = someValue

也许你想要做这样的事情?