1

I have several POMs in my project and a few of them have parent pointing to an artifact outside my repository. So when I release this, I should have different versions for my parent and my project.

I need to search that for POMs with "com.mycompany" as parent groupId and "myproduct" as parent artifactId, the versions-maven-plugin should update the parent version only to 1.0.0. The project version should be unchanged. I'll change the project version normally later on.

I'm unable to do this. What I've tried so far: I have designed a Rules.xml containing:

<ruleset comparisonMethod="maven" xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 http://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
  <rules>
    <rule groupId="com.mycompany" artifactId="myproduct" comparisonMethod="maven"/>
      <ignoreVersions>
        <ignoreVersion type="regex">.*</ignoreVersion>
      </ignoreVersions>
  </rules>
</ruleset>

I have called the versions plugin with

mvn versions:set -DnewVersion=1.0.0 -DprocessProject=false -DrulesUri=file:///doc/Rules/Rules.xml -DgenerateBackupPoms=true

But this didn't update the parent version of those poms.

I also called the update-parent for the same-

mvn versions:update-parent -DparentVersion=1.0.0 -DrulesUri=file:///doc/Jenkinsfiles/PR/version/Rules.xml -DgenerateBackupPoms=true

But this updates all the parent poms for me. I'm guessing my Rules.xml is also wrong. But even so, the parent version is something arbitrary and not parentVersion. Perhaps I do not understand the meaning behind parentVersion in this maven goal. I need it to update to the version of my choice.

Amit
  • 121
  • 1
  • 3
  • 12

0 Answers0