I have configured a Jenkins job to release my maven project automatically. This is done by using the following: mvn --batch-mode clean release:prepare release:perform
I had the same problem and I wanted to resolve it without running more than one command or by inserting the version manually.
Here is my solution for y (or minor) increment:
I run a Groovy script in initialize phase. This script creates release.properties. Add this to your project/build/plugins section in your pom.xml:
org.codehaus.gmavenplus
gmavenplus-plugin
1.5
org.codehaus.groovy
groovy-all
2.4.6
release-parameters
initialize
execute
This script changes also the tag name for vX.Y.Z in your SCM. The initialize phase is not executed in the release:prepare phase. To resolve this issue, you can run a "mvn install" before a release, or change your release command to:
mvn --batch-mode initialize clean release:prepare release:perform
About release.properties: https://maven.apache.org/maven-release/maven-release-plugin/examples/non-interactive-release.html