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

use-releases does not update parent #978

Closed
alerosmile opened this issue Jun 26, 2023 · 2 comments · Fixed by #1007
Closed

use-releases does not update parent #978

alerosmile opened this issue Jun 26, 2023 · 2 comments · Fixed by #1007
Labels
Milestone

Comments

@alerosmile
Copy link

The use-release goal does not update the parent version. The useReleases method does detect required changes, but the
updateDependencyVersion method fails to write the updated version because this comparison is not valid for -SNAPSHOT versions. Artifact.getVersion() returns the timestamped version. In this case the version should be compared against Artifact.getBaseVersion().

I don't know why this comparison is needed anyway. Either remove the comparison or compare against Artifact.getVersion() and Artifact.getBaseVersion() and succeed if one of those succeeds.

@slawekjaranowski
Copy link
Member

There is IT for use-latest-versions
https://github.com/mojohaus/versions/tree/master/versions-maven-plugin/src/it/it-use-latest-versions-011

So we can create similar for use-release

PR with fix are welcome.

@andrzejj0
Copy link
Contributor

andrzejj0 commented Sep 12, 2023

Hi, so it turns out that UseReleasesMojoTest::testProcessParent did not work as intended. Looking into this, but you're also free to provide a fix.

Turns out that test works fine because Artifact.getVersion() can return -SNAPSHOT if the version is a snapshot and not a timestamped version. I guess what we miss is a test testing against a timestamped version as well.

Verified that the goal does work on actual -SNAPSHOT parents.

Still, it doesn't work when the actual artifact in the repo is timestamped.

Using the mock-repository based integration tests doesn't let me reproduce the issue as I haven't found a way to provide metadata (baseVersion which resolves to an actual timestamped version) to the repos. So I'll create another unit test.

NB. The reason why that comparison is there is because the method gets applied to all dependencies fed to it - and in the case of the user updating both the parent and actual dependencies, this comparison acts as a way to select the dependency to update. I guess this might have been done differently.

andrzejj0 added a commit to andrzejj0/versions-maven-plugin that referenced this issue Sep 12, 2023
- added an it testing against a plain (not timestamped) -SNAPSHOT
- added a unit test testing against a timestamped snapshot
- added another comparison for the base version if it exists
@slawekjaranowski slawekjaranowski linked a pull request Sep 12, 2023 that will close this issue
@slawekjaranowski slawekjaranowski added this to the 2.16.1 milestone Sep 12, 2023
slawekjaranowski pushed a commit that referenced this issue Sep 12, 2023
- added an it testing against a plain (not timestamped) -SNAPSHOT
- added a unit test testing against a timestamped snapshot
- added another comparison for the base version if it exists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants