Ant:希望拥有一个包含时间戳的属性

Dav*_*ave 14 ant

我在Ubuntu Linux上使用Ant 1.8.2(以及在运行Cygwin的Windows 7上).我有这个属性......

    <property name="results" location="${selenium.results.dir}/Results-20110922_131005.html" />
Run Code Online (Sandbox Code Playgroud)

我想用一些代表当前时间戳的硬编码代替"20110922_131005".我怎样才能做到这一点?

Dav*_* W. 27

<tstamp>
     <format property="time.stamp" pattern="yyyy-MM-dd_HH:mm:ss"/>
</tstamp>
Run Code Online (Sandbox Code Playgroud)

这将创建一个名为的属性${time.stamp}.

<property name="results" 
    location="${selenium.results.dir}/Results-${time.stamp}.html" />
Run Code Online (Sandbox Code Playgroud)