https://github.com/steinarb/bang-bompom/blob/20d12dd29b2d3758f1c237b3c29df98ecc9125f8/pom.xml#L96

When you set a configuration parameter via XML, you may not override it anymore 
with the property in my experience. 

Mit freundlichen Grüßen
Mirko Friedenhagen
— 
Sent from my mobile

> Am 30.08.2025 um 09:42 schrieb Steinar Bang <s...@dod.no>:
> 
> 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!
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
> 

Reply via email to