TECHO - ANT ECHO task with timestamp
I often find myself writing ANT script which I need to measure times in it.
I can write ANT task for that and include it in my project (I have such task but it will not be in the scope of that post), but it will require me to add files to the source control, manage the build and deployment of the tasks-jar and more while what I want is a quick solution that will not go beyond the scope of my build.xml script.
The quick solution I have for the above requirements is to add a scriptdef for a script called TECHO that will wrap the ECHO task and will able to add a timestamp signiture to the printed message.
For example, if the following echo instance will display the text as displayed below it:
<echo message="Print this text"/>
[echo] Print this text
The matching techo instance will result as follow:
<techo message="Print this text"/>
[echo] Print this text [25/11/2013 13:26:48]
You can of course use Ant-contrib-stopwatch for the same purpose but this will require you to include the antcontrib jar in your build environment and track the stop-watches, while my suggested solution will only provide timestamps printputs.
All you need is to add the below definition in the build.xml file header: