Search code examples
mavenbuild-numbersbuildnumber-maven-plugin

How to display SVN version in Maven usng the build-number plugin


How do display the svn version and the timestamp using build number plugin.

Currently I have the following

<plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>buildnumber-maven-plugin</artifactId>
            <configuration>
                <format>At {0,time} on {0,date} : SVN Revision {1,number}</format>
                <items>
                    <item>timestamp</item>
                    <item>buildNumber</item>
                </items>
                <doCheck>false</doCheck>
                <doUpdate>false</doUpdate>
            </configuration>
        </plugin>
    </plugins>

Which shows up as follows: At 8:02:51 AM on Feb 2, 2011 : SVN Revision 1

But my svn revision is 1123. if I comment out the <format> and <items> I get the correct svn build number. How do I display both?

Thanks


Solution

  • As the documentation says, if you use the special <item> buildNumber, it does not use the SVN Revision, but instead creates/reads a special property file.

    If you do want to use the SVN revision, you need to follow the configuration specified in the first exmaple in the usage page. The other examples are meant to illustrate usages which does not make use of SVN revision, but a local build number (as in case of continuous integration builds).