Thanks Mark. looks easy enough. i may try a maven plugin first though
as i like the idea of maven controlling all the git pushes etc
On 01/03/2018 05:05, Mark Derricutt wrote:
On 1 Mar 2018, at 2:56, Ben Tatham wrote:
Sounds like you're using gitflow (master, develop, feature/*
branches). If
so, we use the jgitflow-maven-plugin instead of
maven-release-plugin, which
handles these transitions and the inherent conflicts caused by the
maven
versioning.
Unfortunately, the maintainer is no longer working on it (and says
he's not
even working in java anymore), but it still works well.
For my own git-flow based releases I have the following
|git-mvnrelease| script I have on the path:
|
#!/bin/sh
if ! git diff-index --quiet HEAD --;then
echo "Git is dirty, clean up your mess!"
exit 1
fi
VERSION=`xml sel -Nx="http://maven.apache.org/POM/4.0.0" -t
-v"/x:project/x:version" pom.xml`
BASEVERSION=${VERSION%-SNAPSHOT}
ARTIFACTID=`xml sel -Nx="http://maven.apache.org/POM/4.0.0" -t
-v"/x:project/x:artifactId" pom.xml`
echo "Removing non-scm files..."
git clean -fdi
echo "Checking master branch for updates..."
git checkout master
git pull origin master
git flow release start$BASEVERSION && mvn release:prepare release:perform&& git flow release
finish -n$BASEVERSION && git push origin&& git push origin --tags
|
This first checks my working directory is clean, just for safety,
extracts the pom.xml version for use in branch/tag names. Switches to
my |master| branch and makes sure it's up to date, then does a batch
release/push.
I don't think I've ever had any issues with maven versioning, unless
the version number as part of the release/merge has changed to
something unexpected.
YMMV
Mark
------------------------------------------------------------------------
"The ease with which a change can be implemented has no relevance at
all to whether it is the right change for the (Java) Platform for all
time." — Mark Reinhold.
Mark Derricutt
http://www.theoryinpractice.net
http://www.chaliceofblood.net
http://plus.google.com/+MarkDerricutt
http://twitter.com/talios
http://facebook.com/mderricutt
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]