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
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven or Ant: SVN revision" Watch "Maven or Ant: SVN revision" New topic

Maven or Ant: SVN revision

Janko Mlakar

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

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

Joined: May 14, 2008
Posts: 5850

For Ant, look at the svnant task, specifically the 'info' command:

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: 16537

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.
I agree. Here's the link:
subject: Maven or Ant: SVN revision