Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在Ant属性中存储UNIX时间戳?_Java_Ant_Timestamp - Fatal编程技术网

Java 在Ant属性中存储UNIX时间戳?

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"

我想在Ant属性中存储一个UNIX时间戳(即,从epoch开始的秒数),以便以后在两个构建目标中使用。这似乎是不可能的:

<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会带来:


海事组织更为清洁的其他办法是:

  • 创建自己的自定义任务。其实没那么难;

  • 使用Maven exec插件来执行Java以执行以下操作:


  • 嗯,很有趣。我在谷歌上搜索了很多次,但我想我的查询中没有包括“时代”。不过,不执行JavaScript也不错。是的,另一种更干净的方法是创建自己的自定义任务。其实没那么难;