Created
November 12, 2014 14:55
-
-
Save skempken/58fb4ab2751299adc390 to your computer and use it in GitHub Desktop.
Fix Build Number with Maven
This file contains 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
# update version number - get current version and replace "SNAPSHOT" with BUILD_NUMBER | |
# Download plugins first | |
mvn -s $MVN_SETTINGS org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | |
# Determine current number in offline mode | |
CURRENT_SNAPSHOT_VERSION=`mvn -o -s $MVN_SETTINGS org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\['` | |
echo CURRENT_SNAPSHOT_VERSION is: $CURRENT_SNAPSHOT_VERSION | |
BUILD_SNAPSHOT_VERSION=`echo $CURRENT_SNAPSHOT_VERSION | sed "s/SNAPSHOT/$BUILD_NUMBER/g"` | |
echo BUILD_SNAPSHOT_VERSION is: $BUILD_SNAPSHOT_VERSION | |
mvn -s $MVN_SETTINGS versions:set -DnewVersion=$BUILD_SNAPSHOT_VERSION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment