How to get revision number from subversion using maven

deploymentmaven-2svnversion-control

I'd like to put revision number on main page of webapp, how can i do that using maven?

P.S. Its two part question, how to get revision number and how to write it into selected file in the project.

Best Solution

The maven build number plugin is the way to go. An example of how to use it is here:

http://www.mojohaus.org/buildnumber-maven-plugin/usage.html

You would use this together with the maven jar plugin to print the SVN commit number to your manifest.

This is a better solution than using a file that contains the SVN commit number, because that adds more moving parts than is really necessary.