Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update-child-modules is doing more than I wish... #190

Closed
chris-nerr opened this issue Jul 18, 2017 · 7 comments
Closed

update-child-modules is doing more than I wish... #190

chris-nerr opened this issue Jul 18, 2017 · 7 comments
Milestone

Comments

@chris-nerr
Copy link

Hello!
I have a maven project with submodules:

A 1.0.0

  • B 1.1.0
    • B-one 1.1.0
    • B-two 1.1.0
    • B-three 1.1.0
  • C 1.1.1
    • C-one 1.1.1
    • C-two 1.1.1

All sub-modules of level 3 have the same version than its parent, for example version of module B-two is the same than its parent B.
If I change the version of my root project A to 2.0.0 and I run the command mvn versions:update-child-modules -DallowSnapshots=true from the root project then the version of the parent of the 3rd-level modules is updated: version of the C-one parent becomes 2.0.0!!
But that is not what I wish, I just want to update the version of artifact A and its direct children = modules of 2nd level.
Help! :)
Thanks. Chris.

@khmarbaise
Copy link
Member

Taken a look on http://www.mojohaus.org/versions-maven-plugin/update-parent-mojo.html ? Best would be you make an example project on Github and describe what you've done and then what you like to see...a concrete project is better than describing it in a long abstract...

@jdileonardo
Copy link
Contributor

I understand the issue, mainly because i'm hitting it as well

Say I have 3 layers of parent inheritance: A, B, and C

A will be an aggregate pom

A pom.xml

  <groupId>com</groupId>
    <artifactId>A</artifactId>
    <version>3.0.0</version>
    <modules>
       <module>B1</module>
        <module>B2</module>
        <module>B3</module>
    </modules>

B1 pom.xml

  <parent>
        <groupId>com</groupId>
    <artifactId>A</artifactId>
    <version>3.0.0-SNAPSHOT</version>
    </parent>

  <groupId>com</groupId>
     <artifactId>B1</artifactId>
     <version>1.0.0-SNAPSHOT</version>

    <modules>
         <module>C1</module>
        <module>C2</module>
         <module>C3</module>
     </modules>

C1 pom.xml

     <parent>
         <groupId>com</groupId>
   <artifactId>B1</artifactId>
    <version>1.0.0-SNAPSHOT</version>
     </parent>

Now if i execute this goal on the A pom.xml, not only will it update the Parent of B1 pom.xml (which is good, because B1's parent is A, and makes sense since the Group and Artifact match

BUT

it will also update the parent of C1's pom.xml, which is BAD, as C1's parent should not jump to 3.0.0, as C1's parent is not A, it's B1.

Basically, this goal is blindly setting all parents to whatever is in A, instead of actually checking if a submodules parent is that of what's in the aggregate pom.

@jdileonardo
Copy link
Contributor

I think i found the issue, i also have some additional unit tests created.

I'll attempt to push them up for review. Need to get my company's OK first however.

@khmarbaise
Copy link
Member

@DiJu519 Do you have the Ok ?

@jdileonardo
Copy link
Contributor

jdileonardo commented Dec 1, 2017 via email

@khmarbaise
Copy link
Member

Ok. Thanks for the fast feedback.

jdileonardo pushed a commit to jdileonardo/versions-maven-plugin that referenced this issue Jan 3, 2018
mojohaus#190

Fixing issue in update-child-modules, where root module's version was
being used in all downstream children even when a child's parent was
different.

Fix was to stop updating local reactor model, as the module's version
was being replaced with a parent version in error, initial reactor model
doesn't require being updated locally.

Testing:
All initial and additional IT's passed running mvn clean verify.

Change-Id: I8682a450fe6c15af8483a80a40f52e2e57377c3e
jdileonardo pushed a commit to jdileonardo/versions-maven-plugin that referenced this issue Jan 26, 2018
mojohaus#190

Fixing issue in update-child-modules, where root module's version was
being used in all downstream children even when a child's parent was
different.

Fix was to stop updating local reactor model, as the module's version
was being replaced with a parent version in error, initial reactor model
doesn't require being updated locally.

Testing:
All initial and additional IT's passed running mvn clean verify.

Change-Id: I8682a450fe6c15af8483a80a40f52e2e57377c3e
@jdileonardo jdileonardo mentioned this issue Jan 26, 2018
@olamy olamy closed this as completed in 05dad7d Feb 10, 2018
@olamy olamy added this to the 3.0.0 milestone Feb 10, 2018
@ghost
Copy link

ghost commented Mar 13, 2019

See: #312 (comment)

@mfriedenhagen mfriedenhagen modified the milestones: 3.0.0, 2.8.0 Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants