Konrad Windszus created MNG-7418:
------------------------------------

             Summary: Incorrect merging of snapshot versions in 
o.a.m.artifact.repository.metadata.Metadata.merge(...)
                 Key: MNG-7418
                 URL: https://issues.apache.org/jira/browse/MNG-7418
             Project: Maven
          Issue Type: Bug
          Components: Artifacts and Repositories
    Affects Versions: 3.8.4
            Reporter: Konrad Windszus


Given that I have two metadata on version level:

{code}
<metadata modelVersion="1.1.0">
<groupId>org.apache.jackrabbit.vault</groupId>
<artifactId>org.apache.jackrabbit.vault</artifactId>
<version>3.5.9-SNAPSHOT</version>
<versioning>
...
<snapshotVersions>
<snapshotVersion>
<extension>jar</extension>
<value>3.5.9-1</value>
<updated>20220218143327</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
</metadata>
{code}

and 

<metadata modelVersion="1.1.0">
<groupId>org.apache.jackrabbit.vault</groupId>
<artifactId>org.apache.jackrabbit.vault</artifactId>
<version>3.5.9-SNAPSHOT</version>
<versioning>
...
<snapshotVersions>
<snapshotVersion>
<extension>jar</extension>
<value>3.5.9-2</value>
<updated>20220220143327</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
</metadata>
{code}

Merging both via 
https://github.com/apache/maven/blob/03df5f7c639db744a3597c7175c92c8e2a27767b/maven-repository-metadata/src/main/mdo/metadata.mdo#L91
 does not lead to two different snapshotVersions but only the one from the 
original metadata.

On the other hand the merge in 
https://github.com/apache/maven/blob/03df5f7c639db744a3597c7175c92c8e2a27767b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java#L72
 does seem to do the merging correctly.

As IMHO the logic of merging should be agnostic of the resolver provider, those 
versions should always be merged using all three fields from 
https://github.com/apache/maven/blob/03df5f7c639db744a3597c7175c92c8e2a27767b/maven-repository-metadata/src/main/mdo/metadata.mdo#L315-L333
 concatenated as ID.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to