Skip to content

Instantly share code, notes, and snippets.

@leonelag
Created May 16, 2013 16:24
Show Gist options
  • Save leonelag/5593003 to your computer and use it in GitHub Desktop.
Save leonelag/5593003 to your computer and use it in GitHub Desktop.
Snippet of Maven POM file that creates a file named REV in your project, before packaging. The contents of the file are the following env variables: SVN_REVISION BUILD_NUMBER BUILD_ID BUILD_TAG
<project>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>prepare-package</phase>
<configuration>
<target>
<echo file="${project.build.directory}/${project.build.finalName}/rev">Svn-Revision: ${env.SVN_REVISION}${line.separator}Build-Number: ${env.BUILD_NUMBER}${line.separator}Build-Id: ${env.BUILD_ID}${line.separator}Build-Tag: ${env.BUILD_TAG}</echo>
</target>
</configuration>
<goals><goal>run</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment