Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Ant中输出属性值?_Ant_Echo_Default Value - Fatal编程技术网

如何在Ant中输出属性值?

如何在Ant中输出属性值?,ant,echo,default-value,Ant,Echo,Default Value,在Ant退出任务回显中: <echo message="Hello, world"/> 如何让Ant显示文件的值?此语句: <property file="${user.home}/build.properties"/> (即该文件中的所有属性),并且不设置名为file的属性 这是正确的。首先设置属性,然后回显它: <property name="file" value="${user.home}/build.properties"/> <ech

在Ant退出任务回显中:

<echo message="Hello, world"/>
如何让Ant显示文件的值?

此语句:

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

(即该文件中的所有属性),并且不设置名为file的属性

这是正确的。首先设置属性,然后回显它:

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

您得到了
${file}
的回音,因为您没有设置该属性。您的属性文件中是否有一行写着
file=someValue

也许你想做这样的事

<property name="property.file" value="${user.home}/build.properties"/>
<property file="${property.file}"/>
<echo message="My property file is called &quot;${property.file}&quot;"/>

<property name="file" value="${user.home}/build.properties"/>
<echo message="${file}" />
<property name="property.file" value="${user.home}/build.properties"/>
<property file="${property.file}"/>
<echo message="My property file is called &quot;${property.file}&quot;"/>