aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven or Ant: SVN revision Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven or Ant: SVN revision" Watch "Maven or Ant: SVN revision" New topic
Author

Maven or Ant: SVN revision

Janko Mlakar
Greenhorn

Joined: Mar 20, 2010
Posts: 7
Is it possible to gather SVN revision and add it to one java file (or application.properties) automatically during build period using ant or maven?

I'm trying to get versioning based on SVN revision.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

For Ant, look at the svnant task, specifically the 'info' command:
http://subclipse.tigris.org/svnant/svn.html#info

That should get you the revision number into a property. Then use the copy task with an 'expandProperties' 'filterChain' to place the revision into the desired file.


JBoss In Action
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16142
    
  21

VCS version numbers make pretty lousy software release version numbers. I've been down that route, and they just don't track nicely. In CVS, it's compounded by the fact that each file has its own version number, based on the number of updates made to it.

I used have a "build version # bump" task in my Ant build files. Maven can do a complete release control action, including bumping the version number in the POM. It handles both snapshot (development release) versioning and production versioning.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
jQuery in Action, 2nd edition
 
subject: Maven or Ant: SVN revision