Question

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

Was it helpful?

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).

OTHER TIPS

Update to version 1.2 of buildnumber-maven-plugin and use scmVersion.

<items>
    <item>timestamp</item>
    <item>scmVersion</item>
</items>

Helped greatly by this SO response.

I ended up using buildnumber-maven-plugin without format parameter to get svn revision, and date using:

<properties>
    <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format>
    <build.date>${maven.build.timestamp}</build.date>
</properties>

then, in filtered resource:

r${buildNumber}, ${build.date}

Does this matter?

"The buildNumber plugin will then update your local repository. This is done because 'svn info' grabs the revision out of your local repository, and is not necessarily the same as the revision in the remote repository. You should probably deal with these changes before creating a build in any case. Again, this behaviour can be suppressed with -Dmaven.buildNumber.doUpdate=false."

http://mojo.codehaus.org/buildnumber-maven-plugin/usage.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top