I'm using Ant 1.8.2 on Ubuntu Linux (and also on Windows 7 running Cygwin). I have this property ...
<property name="results" location="${selenium.results.dir}/Results-20110922_131005.html" />
I would like to replace the "20110922_131005" with something less hard coded that represents the current time stamp. How can I do this?
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.
**\*.sql means "in the given directory and inside all of its subdirectories, all the files that end with .sql"
The home directory for Ant library files - typically ANT_HOME/lib folder. Ant also makes the system properties (Example: file. separator) available to the build file. In addition to the above, the user can define additional properties using the property element.
Properties are key-value pairs where Apache Ant tries to expand ${key} to value at run time. There are many tasks that can set properties; the most common one is the property task. In addition properties can be defined via command line arguments or similar mechanisms from outside of Ant.
<tstamp>
<format property="time.stamp" pattern="yyyy-MM-dd_HH:mm:ss"/>
</tstamp>
This will create a property called ${time.stamp}
.
<property name="results"
location="${selenium.results.dir}/Results-${time.stamp}.html" />
you can use tstamp in ant. Also look at SO Question : output timestamp in ant
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