versions: ${revision} not being updated
This is a sample pom to illustrate the issue ` <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>test-versions</artifactId>
<version>${revision}</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<revision>1.3</revision>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.14.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>`
mvn versions:set -DnewVersion=2.0
With plugin 2.13.0 it resolves all ${revision} to the new version. With plugin 2.14.0 and 2.14.1 it does nothing.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 15 (7 by maintainers)
Commits related to this issue
- Resolves #855: Set should evaluate expressions — committed to ajarmoniuk/versions-maven-plugin by ajarmoniuk 2 years ago
- Resolves #855: Set should evaluate expressions — committed to ajarmoniuk/versions-maven-plugin by ajarmoniuk 2 years ago
- Resolves #855: Set should evaluate expressions — committed to ajarmoniuk/versions-maven-plugin by ajarmoniuk 2 years ago
- Resolves #855: Set should evaluate expressions — committed to ajarmoniuk/versions-maven-plugin by ajarmoniuk 2 years ago
- Resolves #855: Set should evaluate expressions — committed to ajarmoniuk/versions-maven-plugin by ajarmoniuk 2 years ago
- Resolves #855: Set should evaluate expressions — committed to mojohaus/versions by ajarmoniuk 2 years ago
I can play with it, manually. But, as I said, my project has to work with a standard CI pipeline that forces
mvn versions:set -DnewVersion=N.x.0
with every merge tomain
.I have no problem with that scheme, either. To my mind the “least surprise” implementation of
versions:set
on a project that uses$revision
is to simply update the property value in the top levelpom.xml
.In our work environment, all projects use shared CI/CD pipeline code that forces a version update with every merge to
main
by callingmvn versions:set -DnewVersion=1.n.0
, i.e. takes your highest level version number as is, increments your 2nd level version level by 1 and sets the lowest level version to zero (0). It figures out the version number on its own.Because I’m using a multi-module project, I’m using
$revision
to keep parents and children in sync by:$revision
to refer to the parent version from the child modulesFwiw, I don’t see any logical conflict or disconnect between using CI-friendly (
$revision
) andversions:set
. But I’m probably missing something. :–)