Search code examples
antechodefault-value

How in Ant output values of properties?


With ant there exists the echo markup:

<echo message="Hello, world"/>

but it seems useless. I need to check values in an ant script, e.g.

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

but it only yields:

 [echo] ${file}

How I can have Ant display the value of the file property?


Solution

  • This statement:

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

    Reads a property file(i.e. all properties in that file), and does not set the property named file.

    This would be correct. You first set a property and then echo it:

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