Java 在Ant属性中存储UNIX时间戳?
我想在Ant属性中存储一个UNIX时间戳(即,从epoch开始的秒数),以便以后在两个构建目标中使用。这似乎是不可能的:Java 在Ant属性中存储UNIX时间戳?,java,ant,timestamp,Java,Ant,Timestamp,我想在Ant属性中存储一个UNIX时间戳(即,从epoch开始的秒数),以便以后在两个构建目标中使用。这似乎是不可能的: <tstamp> <format property="build.time" /> </tstamp>` ` …生成格式化的时间戳 <propertyfile file="foo.properties"> <entry key="build.time" type="date" default="now"
<tstamp>
<format property="build.time" />
</tstamp>`
`
…生成格式化的时间戳
<propertyfile file="foo.properties">
<entry key="build.time" type="date" default="now" />
</propertyfile>
…还生成格式化的时间戳
<propertyfile file="foo.properties">
<entry key="build.time" type="date" default="now" />
</propertyfile>
我希望这在不使用
或类似工具的情况下是可能的(因为我们有时会在Windows上运行构建)。快速的google会带来:
海事组织更为清洁的其他办法是:
嗯,很有趣。我在谷歌上搜索了很多次,但我想我的查询中没有包括“时代”。不过,不执行JavaScript也不错。是的,另一种更干净的方法是创建自己的自定义任务。其实没那么难;