version:set-property doesn't seem to pick up -Dproperty and -DnewVersion user properties

Steinar Bang <[email protected]>
Newsgroups gmane.comp.jakarta.turbine.maven.user
Organization Probably a good idea
Message-ID <[email protected]>
Platform: debian 13 "trixie", amd64, maven 3.9.10, java 21.0.4, versions-maven-plugin 2.18.0

I am trying to change the bang-servlet.version property in this pom
 https://github.com/steinarb/bang-bompom/blob/master/bang-pom/bang-app-pom/pom.xml#L31
using this script:
 #!/bin/sh
 SERVLET_VERSION=$(cd $HOME/workspaces/servlet; mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec)
 echo $SERVLET_VERSION
 (cd $HOME/git/bang-bompom/bang-pom/bang-app-pom; mvn versions:set-property -Dproperty='bang-servlet.version' -DnewVersion="$SERVLET_VERSION" -DallowSnapshots=true)

But the property in bang-pom/bang-app-pom/pom.xml isn't modified. The
file is unchanged.

I added the -X flag to the mvn command and discovered that <property> is
bang-bom.version and newVersion is 2.1.15-SNAPSHOT (instead of the
3.0.2-SNAPSHOT of SERVLET_VERSION):
 https://gist.github.com/steinarb/f186b038f04ebaf4685af5f04b1dd0ab#file-set-version-log-01-L194

I wondered if I was using the wrong form for the user arguments, but I'm
not, according to the documentation:
 https://www.mojohaus.org/versions/versions-maven-plugin/set-property-mojo.html#property
 https://www.mojohaus.org/versions/versions-maven-plugin/set-property-mojo.html#newVersion

So what am I doing wrong?

Various things I have tried, that haven't worked:
 1. Adding a dependency using the property as version in dependency
    management of the pom I'm trying to modify
 2. Referencing the above dependency managment dependency in the
    <dependencies> section
 3. Removing the dependency management and just having a dependency in
    <dependencies> using the property in <version>
 4. Running the "mvn versions:set-property" command from the top pom
    instead of the pom with the property I'm trying to change
 5. Add "--non-recursive" to the "mvn versions:set-property" command

But, as said, none of those had any effect.

The bang-pom/bang-app-pom/pom.xml file stayed unchanged.

All ideas and hints and suggestions are welcome!

Thanks!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.