42

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?

Olivier
  • 303
  • 3
  • 14
user810430
  • 11,181
  • 15
  • 38
  • 43

2 Answers2

56

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}" />
oers
  • 18,436
  • 13
  • 66
  • 75
8

You're getting ${file} echoed back at you because you're not setting that property. Is there a line in your property file that says file = someValue?

Maybe you want to do something like this?

<property name="property.file" value="${user.home}/build.properties"/>
<property file="${property.file}"/>
<echo message="My property file is called &quot;${property.file}&quot;"/>
David W.
  • 105,218
  • 39
  • 216
  • 337