Hi Meier I have used the following goal:
mvn versions:update-property
-Dproperty="emom.web.dependency.shr.version"
-Dincludes:org.safeway.com:emom-shr
-DgenerateBackupPoms=false
-DallowIncrementalVersios=true
-DallowSnapshots=true
clean package
My Job B pom.xml is:
<dependency>
<groupId>com.safeway.app</groupId>
<artifactId>emom-shr</artifactId>
<version>${emom.web.dependency.shr.version}</version>
</dependency>
Under the properties it has the version hard-coded:
<emom.web.dependency.shr.version>19.6.5-SNAPSHOT</emom.web.dependency.shr.version>
My Job A pom.xml:
<groupId>com.safeway.app</groupId>
<artifactId>emom-shr</artifactId>
<version>20.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
When I run the above goal, Maven is picking the latest version (i.e. 20.1.0) from Artifactory but when I check the pom.xml of Job B under properties it still says 19.6.5. I need a way to change the 19.6.5 or current version to latest version available. Am I doing something wrong? I'm not able to figure it out.
Here's an example of
versions-maven-plugin:update-propertyworking in practice. I've used the common Mockito library as an example that works for everyone as it's in Maven Central.Starting with this POM (noting the
mockito-versionproperty):The simplest way to upgrade it to the latest release version is this:
Replace
mockito-versionwithemom.web.dependency.shr.versionin your case.You can then start to use more of the goal options to adjust the options. For example, you might:
Permit snapshots, not just releases, with
-DallowSnapshots=true.Disallow major version updates (i.e. third element from the right) with
-DallowMajorUpdates=false. Note that the logic around these version number sections seems a bit flaky in the plugin - or isn't how I expect.Avoid creating backup POMs with
-DgenerateBackupPoms=false. This is cleaner, but if you omit this option then you can usemvn versions:revertto get yourself back to where you started.To apply this to your scenario, I think you need to:
Check you've not got typos in your actual command (like you have in the question and comments).
Get rid of options that don't appear in the options.
Probably, keep things simple by not trying to run this in conjunction with anything else (unless it's in automation), so get rid of the
clean packageat the end of the command.