Q:

How to set current datetime in xml file?

I am having a trouble seting the current datetime in my build.xml file.
i am writing a sonarqube propert in xml file and i want to set the version number to current datetime so that after each build i get the different version.
<property name="sonar.projectName" value="test" />
<property name="sonar.projectVersion" value="3.1" />
<property name="sonar.language" value="java" />

so what should i write in value field of the projectVersion so that after each build i get the current datetime as new version value.

A:

You can use the TStamp task, and then use it for the "sonar.projectVersion" property, like in the following example:
...
<tstamp>
  <format property="build.currentDate" pattern="yyyy-MM-dd"/>
</tstamp>

<property name="sonar.projectVersion" value="3.1-${build.currentDate}" />
...

