Skip to content

Instantly share code, notes, and snippets.

@rnorth
Last active September 7, 2016 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rnorth/bae7d984eedfdcac5180a19520dcda0f to your computer and use it in GitHub Desktop.
Save rnorth/bae7d984eedfdcac5180a19520dcda0f to your computer and use it in GitHub Desktop.
Alternative tool for performing Maven Releases - simpler and easier to reason about
#!/usr/bin/env bash
# Maven release helper. Copyright (c) 2016 Richard North <rich.north@gmail.com>
# Usage: mvn-release.sh PROFILES
# where PROFILES should be any maven profile activations to pass through, e.g. `-PprofileA`
#
# Based on this article: https://axelfontaine.com/blog/final-nail.html
#
# IMPORTANT: follow setup steps in that article for required POM configuration settings
set -o errexit
set -o pipefail
set -o nounset
# set -o xtrace
echo "What is the release version number? (e.g. 1.0.1): "
read RELEASE_VERSION
# Update the version number
mvn versions:set -DnewVersion=$RELEASE_VERSION $@
# Ensure the version number change is committed
git commit -a -m "Update release version number to $RELEASE_VERSION" || true
# Deploy then tag on success
mvn clean deploy scm:tag $@
echo "What is the next snapshot version number? (e.g. 1.0.2-SNAPSHOT): "
read NEXT_VERSION
# Update the version number
mvn versions:set -DnewVersion=$NEXT_VERSION $@
# Ensure the version number change is committed
git commit -a -m "Update development version number to $NEXT_VERSION"
git push --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment