Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Java
Expertise: Intermediate
Jan 27, 2004



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Build Output Using the Ant <tstamp/> Task

When you execute <tstamp/>, it generates the local ANT macros ${TSTAMP} and ${DSTAMP}. These are the time and date as numeric strings. They can then be used to dynamically generate timestamp strings. Here is an example in a simple ANT buildfile that generates a timestamped jarfile:

<?xml version="1.0"?>

<project name="tstamp" basedir="." default="jar">
    <property name="src"   value="src"/>
    <property name="obj"   value="obj"/>
	<property name="jar"   value="tstamp"/>

	<target name="clean">
		<delete file="${jar}.jar"/>
		<delete dir="${obj}"/>
		<delete dir="${doc}"/>

    <target name="compile">
        <javac srcdir="${src}" destdir="${obj}" source="1.4" debug="true"
deprecation="true" />

    <target name="jar" depends="compile">
        <jar jarfile="${jar}-${DSTAMP}${TSTAMP}.jar" compress="true">
			<fileset dir="${obj}" includes="**/*"/>
			<fileset dir="${src}" includes="**/*"/>
The above build.xml outputs a jarfile named 'tstamp-200307011540.jar'
David Howard
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date