SVN_REVISION
For Subversion-based projects, this variable contains the current revision number.
CVS_BRANCH
For CVS-based projects, this variable contains the branch of the module. If CVS is configured
to check out the trunk, this environment variable will not be set.
These variables are easy to access. In an Ant script, you can access them using the
as shown here:
<target name="printinfo">
<property environment="env" />
<echo message="${env.BUILD_TAG}"/>
</target>
In Maven, you can access the variables either in the same way (using the βenv.β prefix), or directly
using the Jenkins environment variable. For example, in the following pom.xml file, the project URL
will point to the Jenkins build job that ran the mvn site build:
<project...>
...
<groupId>com.wakaleo.gameoflife</groupId>
<artifactId>gameoflife-core</artifactId>
<version>0.0.55-SNAPSHOT</version>
<name>gameoflife-core</name>
<url>${JOB_URL}</url>
Alternatively, if you are building a web application, you can also use the maven-war-plugin to insert
the build job number into the web application manifest, e.g.:
<project>
...
<build>
...
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<archive>
<manifestEntries>
<Specification-Title>Continuous Integration with Hudson (Content)</Specification-Title>
<Specification-Version>1.0.0-SNAPSHOT</Specification-Version>
<Implementation-Version>${BUILD_TAG}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
...
</plugins>