Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get revision number from subversion using maven?

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.

like image 243
IAdapter Avatar asked Mar 17 '09 14:03

IAdapter


People also ask

How do I find my svn revision number?

To find information about the history of a file or directory, use the svn log command. svn log will provide you with a record of who made changes to a file or directory, at what revision it changed, the time and date of that revision, and, if it was provided, the log message that accompanied the commit.

What is revision number in svn?

As you saw in the section called “Revisions”, revision numbers in Subversion are pretty straightforward—integers that keep getting larger as you commit more changes to your versioned data.

How do I revise in svn?

"svn info --show-item revision" will give the current revision to which the current directory is updated.

What is Buildnumber Maven plugin?

This plugin is designed to give you a build number. So when you might make 100 builds of version 1.0-SNAPSHOT, you can differentiate between them all.


2 Answers

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.

like image 162
James Kingsbery Avatar answered Sep 19 '22 12:09

James Kingsbery


If you are using subversion, you can use this plugin to make the SVN revision number available as a maven property

http://code.google.com/p/maven-svn-revision-number-plugin/

I combine this with jar plugin to add the SVN revision to the MANIFEST.MF file for our jar's and war's.

like image 31
Jeff Caddel Avatar answered Sep 20 '22 12:09

Jeff Caddel