开发者

how to inject ant build time to an html page

开发者 https://www.devze.com 2023-02-16 02:04 出处:网络
Anyone know how to inject an ant 开发者_如何学JAVAbuild date time stamp into an html page?When you refer ant, I assume you\'re on Java.

Anyone know how to inject an ant 开发者_如何学JAVAbuild date time stamp into an html page?


When you refer ant, I assume you're on Java. You can use tstamp task and echo to a property file. This property file can be bundled into the jar so that the application can read the property and display the value as required.

Ex:

<target name="build.timestamp">        
<tstamp>
<format property="build.timestamp" pattern="yyyy.MM.dd-hh.mm.ss" locale="en,UK"/>
</tstamp>
<echo message="tstamp=${build.timestamp}" file="build-timestamp.properties"/>
</target>

This will create a build-timestamp.properties in current ant directory. Jar it up as a regular resource file along with application classes so that it becomes available at app run time.

0

精彩评论

暂无评论...
验证码 换一张
取 消