So, today I came up with an issue when branching and renaming the maven version in a @mapaprop update. Maven release plugin really sucks when it is connected to Git. It does everything in the mainline. If your mainline (master) is your production release branch this then maven:release is really useless, so I came up with this shell script that basically does..

  • Assuming you are in the master branch
  • Enter the next %version% which will be a -SNAPSHOT
  • Creates and checkout a git branch named %VERSION%-SNAPSHOT
  • Pushes the git branch
  • Uses mojo version plugin for renaming the version to %VERSION%-SNAPSHOT

echo "Starting git branching..."
echo "Enter new branch version: (ie. 1.2.3) "
echo "Building branch version $VERSION-SNAPSHOT"

echo "Pushing branch $VERSION-SNAPSHOT to remote origin"
git push origin master MYPROJECT-$VERSION-SNAPSHOT

echo "Updating Maven version..."
mvn versions:set -DnewVersion=$VERSION-SNAPSHOT

Here you get the info for the Mojo plugin