if you use maven, especially if you want the build number from svn (although it could generate unique build numbers for you through the configuration), look at buildnumber-maven-plugin .
you simply add a fragment similar to the following to the pom.xml file:
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> <version>1.0-beta-3</version> <executions> <execution> <phase>validate</phase> <goals> <goal>create</goal> </goals> </execution> </executions> <configuration> <doCheck>true</doCheck> <doUpdate>true</doUpdate> </configuration> </plugin>
then use $ {buildNumber} later in your pom to refer to the build id. I use it to write this number in the manifest like this using the maven-war plugin.
<archive> <manifest> <addDefaultImplementationEntries>true</addDefaultImplementationEntries> </manifest> <manifestEntries> <Implementation-Build>${buildNumber}</Implementation-Build> </manifestEntries> </archive>
source share