In maven projects the version of a project is contained in the <version>
attritbute of the pom.xml file. When creating a new release in the git flow model I need to bumb the version number. This article explains how this is done (without maven):
- Create a release branch
- Change the version number and commit
- Merge the release branch both to develop and master
Additionally it says:
It is exactly at the start of a release branch that the upcoming release gets assigned a version number—not any earlier. Up until that moment, the develop branch reflected changes for the “next release”, but it is unclear whether that “next release” will eventually become 0.3 or 1.0, until the release branch is started. That decision is made on the start of the release branch and is carried out by the project’s rules on version number bumping.
I see two problems in conjunction with maven here:
- The version under development in maven would be [next version]-SNAPSHOT. So we cannot really postpone the decision which version is next up to the moment we create a release branch. Of course if we can change our mind later, but we already need to enter /some value/ here earlier.
- Before creating our release the version in the pom.xml was let's say
1.1-SNAPSHOT
. Now we have changed that to simply1.1
on the release branch and merged that to master. Fine. But we should also merge that branch back to develop and for that we need to adapt the version to e.g.1.2-SNAPSHOT
. And probably we should not have done that on the release branch because that commit should not be part of the release. Actually we probably should have made this change right after branching off develop because all future commits on develop will be for the next version.
When googling for the problem I found some articles about maven-plugins that can automate the process, which may be interesting, but this question is really on how the git graph should look like and where the version bump commits should be and not how I can automate this using a maven-plugin.