Sunday, March 21, 2010

How to add a timestamp to a jar manifest

<tstamp>
<format pattern="dd-MMMM-yyyy HH:mm:ss" property="-war-create-date">
<format pattern="yyyy" property="-war-copyright-year">
</tstamp>

<target depends="init" name="jar">
<mkdir dir="${build.jar.dir}">
<jar index="off" destfile="${build.jar.dir}/${jar.filename}">
<fileset dir="${basedir}">
<include name="css/**">
<include name="imgs/**">
</fileset>
<manifest>
<attribute name="Built-By" value="${user.name}">
<attribute name="Built-On" value="${-war-create-date}">
<section name="Project-Information">
<attribute name="Project-Title" value="IKM presentation">
<attribute name="Company" value="IRD - copyright ${-war-copyright-year}">
<attribute name="Implementation-Title" value="${component.name}">
<attribute name="Implementation-Version" value="${component.version}">
</section>
</manifest>
</jar>
</target>