Maven Release: suggest next minor instead of patch/fix (1.X.0 instead of 1.0.X)

Viewed 428

I use the maven release plugin a lot. It works flawlessly so far, but one thing annoys me. Look at my latest release command I just fired (mvn release:prepare):

enter image description here

I worked on the current version 1.4.0-SNAPSHOT (built a few new features etc.) It's the "normal" release train, speaking I am not patching this version but rather bringing a new version on the road. My 1.4.0 shall now be finished and released.

After that I want to be working on version 1.5.0, the next release, as this is my new planned version. But the release plugin makes suggestions/autocomplete for patch level (third number, 1.4.1-SNAPSHOT in my case). I want it for minor level (second number, so that it suggests 1.5.0-SNAPSHOT).

If there are fixes to be done, I usually branch a tag, fix the bugs, and release a patch (1.4.1 for my case), and merge it back into my trunk, providing the 1.5.0 version the same bugfixes. I am unsure if this is "the right way" or if there is even a really right way, but that's how we work in my company.

So my question is: Is there a way to adjust the maven release settings so that it suggests minor updates rather than patch updates?

As of today I need to type my desired versions by hand (no biggie, but I am curious if maven might be able to support me here).

PS: I found some SO questions but their answers didn't fit me well. Also they are a few years old, maybe now there are proper solutions without some groovy scripts or similar ...:

1 Answers

The SemVerVersionPolicy can be used to update the minor version.

<plugin>
    <artifactId>maven-release-plugin</artifactId>
    <version>3.0.0-M4</version>
    <configuration>
        <projectVersionPolicyId>SemVerVersionPolicy</projectVersionPolicyId>
    </configuration>
</plugin>

This will propose the version 1.5.0-SNAPSHOT instead of 1.4.1-SNAPSHOT.

Related