0
votes

I am using the maven release plugin to create branches and to release our stack. We are using subversion.

We branch from trunk when we are near to release date.

We develop features for this release on the new branch. We develop new features on trunk.

We release from the branch when we think it's ready (consider this a release candidate) We test the release, and release (to staging) when tests have passed.

If we need to release again if tests failed we release from the branch. Maven release plugin neatly increases the patch version (we version projects PROJECT-major.minor.patch) on the commit that goes into our tag directory (we version projects PROJECT-major.minor.patch) during each release from branch.

So far so good. Only that the trunk patch version does not change during each release, so I feel there is a risk our version numbers will get bungled.

The only way around it seems to be to branch from trunk before each release, but this has a whole bunch of other problem associated with it.

Is there a maven way to maintain the artifactIds SNAPSHOT version so that it is always 1 greater than the released version? I'm looking for an automated way, so I do not have to inspect the released pom and compare to the trunk pom with some other tool.

Or could we do flip it on it's head: create a new branch for new features, and keep developing on trunk for the current release, and agree we always branch+release (and never branch+release+release+etc), when we want to release a project?

Once it's released to production, we merge the new feature branch into trunk? Can maven do this?

1
I would assume that your release branch contains a version like 1.2.0-SNAPSHOT and you will release this as 1.2.0. If you fail (tests etc.) you will change that to 1.2.1 etc. On trunk you have continued in the meantime with 1.3.0-SNAPSHOT development. So after releasing the branch you need to merge back the changes from branch back to trunk. May be i misunderstand this..but i don't really see the problem. Or in other words you would create the release branch and decided to call that version on the branch 2.1.0-SNAPSHOT etc. ? - khmarbaise
The problem is that the maven release plugin does not manage the POM version of the trunk if we release more than once from one branch. So we end up with a branch with a higher snapshot version than trunk. Bear in mind that we want the maven release and versions plugin to handle all this in batch mode. - Jepper

1 Answers

0
votes

Maven release plugin only affects the branch where it operates.

Lets make an example. You are going to release a version 1.5.0, your next version you will prepare on trunk is 1.6.0. In this case you should switch the version on the trunk to 1.6.0-SNAPSHOT. You can then release an 1.5.1, 1.5.2,... without the problem that your trunk version is lower than the branch version.

Check out the Maven version plugin (goal set). to change versions over the whole project strucuture.