build.xml文件设置日期和时间作为文件名 [英] build.xml to set date and time as file name
问题描述
我想设置文件名,日期和时间连接到它,所以我希望创建命名为文件贝哈特-20140913-195915.html
但是下面的例子设置名称作为贝哈特-YYYYMMDD-hhiiss.html
。任何人都知道解决问题呢?
我跟着这个例子一>
注意:这两个不工作太: $ {DSTAMP} $ {TSTAMP}
<?XML版本=1.0编码=UTF-8&GT?;<,项目名称=运动默认为集结默认BASEDIR => <&TSTAMP GT;
<格式属性=TODAY_MY模式=年月日 - hhiiss区域设置=EN,英国/>
< / TSTAMP> <目标名称=构建描述=跑步是为了一切......取决于=贝哈特-BDD/> <目标名称=贝哈特>
<回声味精=运行测试贝哈特.../>
< EXEC logoutput =真checkreturn =真
命令=斌/贝哈特--format HTML --out $ {DIR-报告} -f进度/贝哈特 - $ {} TODAY_MY的.htmlDIR =.//>
< /目标与GT;< /项目>
借助 TSTAMP任务被记录在 ANT手动。它描述了模式格式如何来源于SimpleDateFormat的对象:
我建议尝试以下操作:
示例
构建文件:build.xml文件建立:
[回应]日期:20140913-203419
的build.xml
<项目名称=演示默认为建> <&TSTAMP GT;
<格式属性=TODAY_MY模式=YYYYMMDD-HHMMSS区域设置=EN,英国/>
< / TSTAMP> <目标名称=打造>
<回声消息=日期:$ {} TODAY_MY/>
< /目标与GT;< /项目>
软件版本
$蚂蚁-v
Apache Ant的(TM)版本1.9.4 2014年4月29日编译$ Java的版本
Java版本1.7.0_25
的Java(TM)SE运行时环境(建立1.7.0_25-B15)
Java的热点(TM)64位服务器VM(建设23.25-B01,混合模式)
I want to set file name with date and time attached to it so I want to create file named as behat-20140913-195915.html
however the example below sets the name as behat-yyyymmdd-hhiiss.html
. Anyone know the solution to problem?
I followed this example
Note: These two don't work too: ${DSTAMP} ${TSTAMP}
<?xml version="1.0" encoding="UTF-8"?>
<project name="Sport" default="build-default" basedir=".">
<tstamp>
<format property="TODAY_MY" pattern="yyyymmdd-hhiiss" locale="en,UK" />
</tstamp>
<target name="build" description="Runs everything in order ..." depends="behat-bdd" />
<target name="behat">
<echo msg="Running Behat tests ..." />
<exec logoutput="true" checkreturn="true"
command="bin/behat -f progress --format html --out ${dir-report}/behat-${TODAY_MY}.html" dir="./" />
</target>
</project>
The tstamp task is documented in the ANT manual. It describes how the pattern format comes from the SimpleDateFormat object:
I suggest trying the following:
Example
Buildfile: build.xml
build:
[echo] date: 20140913-203419
build.xml
<project name="demo" default="build">
<tstamp>
<format property="TODAY_MY" pattern="yyyyMMdd-HHmmss" locale="en,UK" />
</tstamp>
<target name="build">
<echo message="date: ${TODAY_MY}"/>
</target>
</project>
Software versions
$ ant -v
Apache Ant(TM) version 1.9.4 compiled on April 29 2014
$ java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
这篇关于build.xml文件设置日期和时间作为文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!