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

[tycho-version-plugin] Since 4.0.5 non-matching version of child modules are forcefully overwritten #3808

Closed
sratz opened this issue May 3, 2024 · 3 comments · Fixed by #3836

Comments

@sratz
Copy link
Contributor

sratz commented May 3, 2024

tycho-version-plugin:set-version states:

Sets the version of the current project and child projects with the same version, and updates references as necessary.

Consider the following structue:

pom.xml: version=2.0.0 [modules=P,Q]
P/pom.xml: version=2.0.0, parent=2.0.0 [modules=m1,m2]
P/m1/pom.xml: version=2.0.0, parent=2.0.0
P/m2/pom.xml: version=2.0.0, parent=2.0.0
Q/pom.xml: version=1.0.0, parent=2.0.0 [modules=m3,m4]
Q/m3/pom.xml: version=1.0.0, parent=1.0.0
Q/m4/pom.xml: version=1.0.0, parent=1.0.0

Execute: set-version -DnewVersion=2.0.1

Result with Tycho <= 4.0.4:

pom.xml: version=2.0.1 [modules=P,Q]
P/pom.xml: version=2.0.1, parent=2.0.1 [modules=m1,m2]
P/m1/pom.xml: version=2.0.1, parent=2.0.1
P/m2/pom.xml: version=2.0.1, parent=2.0.1
Q/pom.xml: version=1.0.0, parent=2.0.1 [modules=m3,m4]
Q/m3/pom.xml: version=1.0.0, parent=1.0.0
Q/m4/pom.xml: version=1.0.0, parent=1.0.0

Result with Tycho >= 4.0.5:

pom.xml: version=2.0.1 [modules=P,Q]
P/pom.xml: version=2.0.1, parent=2.0.1 [modules=m1,m2]
P/m1/pom.xml: version=2.0.1, parent=2.0.1
P/m2/pom.xml: version=2.0.1, parent=2.0.1
Q/pom.xml: version=2.0.1, parent=2.0.1 [modules=m3,m4]
Q/m3/pom.xml: version=2.0.1, parent=2.0.1
Q/m4/pom.xml: version=2.0.1, parent=2.0.1

This is incorrect as the with the same version contract is violated and also all the mis-matching versions of 1.0.0 are forcefully updated to 2.0.1.

This is a side-effect of #3341 / #3343

@laeubi
Copy link
Member

laeubi commented May 3, 2024

@sratz do you like to add this as a testcases here and propose a fix:

https://github.com/eclipse-tycho/tycho/tree/main/tycho-its/projects/tycho-version-plugin/set-version

@sratz
Copy link
Contributor Author

sratz commented May 3, 2024

@sratz do you like to add this as a testcases here and propose a fix:

https://github.com/eclipse-tycho/tycho/tree/main/tycho-its/projects/tycho-version-plugin/set-version

Yes, however I am trying to put my head around the intention of #3341 / #3343: Am I understanding it right that

  • before: Nested projects were only updated when a child module also had a <parent> reference back?
  • after: Nested projects are also updated even when they do not have a <parent> reference?

Why was this needed? My gut feeling tells me that if a child module does not link to a <parent>, it should be considered more loosely coupled and not updating its version is probably OK?

@laeubi
Copy link
Member

laeubi commented May 3, 2024

Well the problem is that the set-version mojo is somehow "limited" and only a few cases are covered and often in "real" setups you get surprising results. e.g there are cases where are multiple parents and maybe aggregator poms that only list childs, in your example A = pom.xml: version=2.0.1 [modules=P,Q] aggregates P+Q, now assume that P does not has a parent ref to A then the mojo will only update A but nothing else even though all projects are part of the reactor.

So basically, everything that is in the reactor should be considered as maven is considering that as well, there is no need for a direct parent/child relation.

sratz added a commit to sratz/tycho that referenced this issue May 8, 2024
Fix regression introduced in eclipse-tycho#3343.

Also for the child modules the version of the change must match, so that
it does not blindly overwrite the versions of the submodules.

Fixes eclipse-tycho#3808.
laeubi pushed a commit that referenced this issue May 8, 2024
Fix regression introduced in #3343.

Also for the child modules the version of the change must match, so that
it does not blindly overwrite the versions of the submodules.

Fixes #3808.
eclipse-tycho-bot pushed a commit that referenced this issue May 8, 2024
Fix regression introduced in #3343.

Also for the child modules the version of the change must match, so that
it does not blindly overwrite the versions of the submodules.

Fixes #3808.

(cherry picked from commit 8cb0cc7)
eclipse-tycho-bot pushed a commit that referenced this issue May 8, 2024
Fix regression introduced in #3343.

Also for the child modules the version of the change must match, so that
it does not blindly overwrite the versions of the submodules.

Fixes #3808.

(cherry picked from commit 8cb0cc7)
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

Successfully merging a pull request may close this issue.

2 participants