My initial thought was to automate your POM version numbers, partially crowding out the POM <version> calculations, see later in the answer. If you don't want to do this, you need to reevaluate the Git workflow.
Merging the two paths, in master , and then back to the function branch causes problems. Your git merge branch/FEA-650 -s ours , using our strategy, tells Git that you have included everything and changes from the function branch to master , including changing the version of pom.xml that is lost, with master saving its version. The leading branch now considers that the HEAD function branch is a common ancestor (it is the parent commit at merge), so when you merge it back into the function branch, Git says: “everything was allowed when you merged with the master, there are no changes. .. fast forward. "
The simple answer is that after merging with the master, you need to transfer the branch to a new function branch, providing the branches of your function to a new / younger common ancestor, then you need to somehow reset the POM <version> change. You should not continue to work with the original function branch since it has been merged. To get new changes from the wizard, you must flip. It seems that there are some prerequisites that you may have left the changes in the function branch not related to the wizard, otherwise you will no longer need it, and you can translate the branch, or it can only be the <version> change tags that interest you .
There are several ways to simplify / speed up / automate version number management during repeated branching, from emergency (see below) to cherry-picking it from the placeholder branch using the Maven plugin, for example. Versions of Maven Plugin .
Original answer
Another approach would be to externally calculate the final / effective <version> outside your POM file based on branch metadata or other input from your CI. This is a little tricky to do in Maven without first pom.xml yourself after checking, but check out the Maven External Version Plugin .
It connects to the Maven life cycle and will create the pom.xml.new-version file “on the fly” (which you can .gitignore ), dynamically replacing all or part of the version number based on what you supply — the name, Git attribute branches commit hash etc.
Create / deploy the plugin and add it to your POM:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-external-version-plugin</artifactId> <version>0.1.0-SNAPSHOT</version> <extensions>true</extensions> <configuration> <strategy hint="sysprop"/> </configuration> </plugin>
... then create an ad with a replacement version string, for example, you can:
mvn install -Dexternal.version-qualifier=$(git symbolic-ref
... which will change 1.2.3-SNAPSHOT to 1.2.3-FEA-650-SNAPSHOT if the currently posted Git branch is FEA-650 . Maybe you should consider replacing / with - in your branch naming strategy, depending on what Maven thinks about it (I find / confusing, but it's just me) or modifying sed accordingly.
In the worst case scenario, this will allow you to remove your version number from your POM, so other POM changes can be safely combined and, as you know, are not related to the version number - if necessary, you can save the version numbers in another file using the Maven Properties plugin to download and if necessary replace the entire version number.