Created
November 16, 2010 23:06
-
-
Save alexschwartz/702706 to your computer and use it in GitHub Desktop.
Using a smart build number (Maven2 pom.xml)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<version>${smartBuildNumber}</version> | |
.... | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.codehaus.mojo</groupId> | |
<artifactId>buildnumber-maven-plugin</artifactId> | |
<version>1.0-beta-5-git</version> | |
<executions> | |
<execution> | |
<phase>validate</phase> | |
<goals> | |
<goal>create</goal> | |
</goals> | |
</execution> | |
</executions> | |
<configuration> | |
<doCheck>false</doCheck> | |
<doUpdate>false</doUpdate> | |
<getRevisionOnlyOnce>true</getRevisionOnlyOnce> | |
<revisionOnScmFailure>UNKOWN</revisionOnScmFailure> | |
<!-- for SVN --> | |
<useLastCommittedRevision>true</useLastCommittedRevision> | |
</configuration> | |
</plugin> | |
<plugin> | |
<groupId>org.codehaus.groovy.maven</groupId> | |
<artifactId>gmaven-plugin</artifactId> | |
<executions> | |
<execution> | |
<phase>validate</phase> | |
<goals> | |
<goal>execute</goal> | |
</goals> | |
<configuration> | |
<source> | |
println "smart build number: ${buildNumber}, ${scmBranch}" | |
def scmBranchSave = project.properties.getProperty('scmBranch').replaceAll('/','') | |
project.properties.setProperty('smartBuildNumber', "$scmBranchSave-${buildNumber}") | |
//println "properties: ${project.properties}" | |
</source> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One drawback: