In Ant exits task Echo:
<echo message="Hello, world"/>
But it seems useless. I need to check values in ant file. E.g.
<property file="${user.home}/build.properties"/> <echo message="${file}" />
but I receive only:
[echo] ${file}
How I can have Ant display value of file?
The <property> task is used to set the Ant properties. The property value is immutable, once the value is set you cannot change it. To set a property to a specific value you use Name/value assignment. To set a property to a location you use Name/location assignment.
Ant Properties are set once and then can never be overridden. That's why setting any property on the command line via a -Dproperty=value will always override anything you've set in the file; the property is set and then nothing can override it. This way: Anything set at the command line takes precedence over build.
The name of the project, as specified in the name attribute of the project element. The default target of the current project. Comma separated list of the targets that were invoked in the current project. The full location of the Ant jar file.
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}" />
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 "${property.file}""/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With