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

Set goal with newVersion and oldVersion arguments specified fails to update only the versions which matches the oldVersion and updates all the versions #794

Closed
soselamet opened this issue Oct 25, 2022 · 3 comments · Fixed by #799
Labels
Milestone

Comments

@soselamet
Copy link

soselamet commented Oct 25, 2022

Set goal with newVersion and oldVersion arguments specified fails to update only the versions which matches the oldVersion and updates all the versions.

Example :
command line / mvn versions:set -DnewVersion="TEST" -DoldVersion="TEST2"

Sample maven execution output log lines :

[INFO] Processing change of com.some.obscure.company.someniftymodule-parent:TEST2 -> TEST
.
.
.
[INFO] Updating project com.some.obscure.company.someniftymodule-document-parent
[INFO] from version 0.101.1-SNAPSHOT to TEST

Possible Solution :
Please see the diff file in the zip archive below for the possible fix.

oldVersion_fix.zip

@soselamet soselamet changed the title Set goal with newVersion and oldVersion aguments specified fails to update only the versions which matches the oldVersion and updates all the versions Set goal with newVersion and oldVersion arguments specified fails to update only the versions which matches the oldVersion and updates all the versions Oct 25, 2022
@andrzejj0
Copy link
Contributor

andrzejj0 commented Oct 26, 2022

Would you like to make a PR with your changes?

Your diff breaks a few integration tests:

[ERROR] The following builds failed:
[ERROR] *  it-set-004/pom.xml
[ERROR] *  it-set-007/pom.xml
[ERROR] *  it-set-008/pom.xml
[ERROR] *  it-set-017-issue-321/pom.xml

I haven't thought of the issue yet.

@andrzejj0
Copy link
Contributor

andrzejj0 commented Oct 26, 2022

I was able to reproduce the issue.

It does not occur if the artifact with the given oldVersion is found in the reactor.

Strangely, if the artifact with the given version is not found, then the root model is changed anyway! I don't understand the reason for it, need to see why this has been done like that. Obviously, as mentioned earlier, your change breaks a few tests. It could have also been done earlier in the stack, in the main method (execute).

However, we're dealing with old code, and, as I said, I need to undestand the reason it's been done like that first in the first place. 😆

It is very likely that I'll rewrite the whole goal.

@soselamet
Copy link
Author

Thank you for taking this issue in your focus.

The diff I shared was a quick and experimental snippet that was not intended to be a PR level contribution.

I guess integration tests are not executed as part of the regular maven install profile so I didn't observe any test failure. 😃

Please let me know if there is a need for direct contribution via a PR.

andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Oct 26, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Oct 26, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Nov 3, 2022
andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Nov 3, 2022
@slawekjaranowski slawekjaranowski added this to the 2.14.0 milestone Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants