Maven : Increment build number with ant

This page last changed on Apr 13, 2006 by Kees de Kooter

This ant task increment the build number in the file and also stores the same information in the MANIFEST.MF.

<!-- keep track of version & build number -->
<target name="increment-build" depends="find_revision">
    <propertyfile file="${config.dir}/" 
        comment=" This file is updated by Ant - do not edit!!!">
        <entry key="major.version" default="0" />
        <entry key="minor.version" default="1" />
        <entry key="svn.revision" value="${revision.number}"/>
        <entry key="build.number" type="int" value="1" operation="+" />
        <entry key="" type="date" value="now" pattern="dd-MM-yyyy HH:mm" />
    <!-- Create manifest file to be included by jar tasks -->
    <property file="${config.dir}/"/>
    <echo>Setting revision ${revision.number} to ${build.dir}/MANIFEST.MF file.</echo>
    <manifest file="${build.dir}/MANIFEST.MF">
        <attribute name="Revision" value="${revision.number}"/>
        <attribute name="Issue-Date" value="${}"/>

The same solution but then as a maven plugin: Increment Build Number