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

[MNG-5180] merge snapshotVersions in repository metadata correctly #681

Closed
wants to merge 1 commit into from

Conversation

kwin
Copy link
Member

@kwin kwin commented Feb 22, 2022

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a JIRA issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a JIRA issue. Your pull request should address just this issue, without
    pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [MNG-XXX] SUMMARY, where you replace MNG-XXX
    and SUMMARY with the appropriate JIRA issue. Best practice is to use the JIRA issue
    title in the pull request title and in the first line of the commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the Core IT successfully.

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

This builds upon the work from #371 and supersedes it.

@kwin kwin force-pushed the bugfix/MNG-5180 branch 2 times, most recently from 779226b to d831705 Compare February 22, 2022 17:46
@kwin
Copy link
Member Author

kwin commented Feb 22, 2022

@michael-o This is how I think the merge is reasonable. The same named method in

is IMHO different from Metadata.merge() as the former does a recessive merge but I don't think this is reasonable here, therefore I don't think we have to consider it here any further.

I think it boils down to the question whether multiple or only one snapshotVersion is allowed per extension and classifier in https://maven.apache.org/ref/3.8.3/maven-repository-metadata/repository-metadata.html#class_snapshotVersion.
I currently assume that it is multiple ones but looking at https://repository.apache.org/content/repositories/snapshots/org/apache/maven/maven-core/4.0.0-alpha-1-SNAPSHOT/maven-metadata.xml one could also think, only one SNAPSHOT version is allowed.

Update: I updated the code to be in line with RemoteSnapshotMetadata.merge() now and made sure that only the most recent version per classifier/extension is listed in the metadata.

@michael-o
Copy link
Member

@kwin Going through. Do you think that the impl in Resolver is correct?

</field>
<field>
<name>updated</name>
<version>1.1.0+</version>
<type>String</type>
<description>The timestamp when this version information was last updated. The timestamp is expressed using UTC in the format yyyyMMddHHmmss.</description>
<identifier>true</identifier>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you show where version and updated are part of an id now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for letting Modello generate a complete equals method which is used e.g. in https://github.com/apache/maven/pull/681/files#diff-a8781d28a4f703eaad1745f9002678d2e273d9189fb9a5f97a79df346f4c1953R129

@kwin
Copy link
Member Author

kwin commented Feb 23, 2022

Do you think that the impl in Resolver is correct?

yes, but you have to keep in mind how its merge is called (

): The arguments are inverted to the merge from Metadata. For the former the destination is given as argument while for the latter the source is given as argument.

@kwin kwin marked this pull request as ready for review February 23, 2022 16:17
Copy link
Member

@michael-o michael-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the copied classes from Resolver. This makes the test brittle for the future.

@kwin kwin requested a review from michael-o February 24, 2022 07:47
michael-o pushed a commit to kwin/maven that referenced this pull request Feb 26, 2022
…data merge

Coauthored-by: Konrad Windszus <kwin@apache.org>

This closes apache#681
@michael-o
Copy link
Member

Please provide a backport for 3.8.x

…data merge

Coauthored-by: Konrad Windszus <kwin@apache.org>

This closes apache#681
kwin pushed a commit to kwin/maven that referenced this pull request Feb 27, 2022
…data merge

Coauthored-by: Konrad Windszus <kwin@apache.org>

This closes apache#681
@kwin
Copy link
Member Author

kwin commented Feb 27, 2022

Please provide a backport for 3.8.x

Done in #684

kwin pushed a commit to kwin/maven that referenced this pull request Feb 27, 2022
metadata merge

Co-authored-by: Konrad Windszus <kwin@apache.org>

This closes apache#681
@asfgit asfgit closed this in 1e33a57 Feb 27, 2022
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 this pull request may close these issues.

3 participants