You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/08/29 18:31:35 UTC

[GitHub] [maven] hgschmie commented on a diff in pull request #795: MNG-7529 alternate fix

hgschmie commented on code in PR #795:
URL: https://github.com/apache/maven/pull/795#discussion_r957672524


##########
maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java:
##########
@@ -242,6 +231,28 @@ private Versioning readVersions( RepositorySystemSession session, RequestTrace t
         return ( versioning != null ) ? versioning : new Versioning();
     }
 
+    private Versioning filterVersionsByRepositoryType( Versioning versioning, RemoteRepository remoteRepository )
+    {
+        if ( remoteRepository == null )
+        {
+            return versioning;
+        }
+
+        Versioning filteredVersions = versioning.clone();
+
+        for ( String version : versioning.getVersions() )
+        {
+            boolean snapshotVersion = version != null && version.endsWith( SNAPSHOT );

Review Comment:
   there is a similar routine, yes. However, it can not be used here because the "versioned snapshot" match is not correct. 
   
   A remote repository would report timestamp versioned  information in the `<snapshotVersion>` section of the maven-metadata.xml file. 
   
   Using this method actually introduces a new bug if someone accidentally chooses this version pattern as their release version. In 2,252 local maven-metadata files in my current repos, there are exactly 0 versions listed that match the data pattern, however there are 1,044 versions that end with `-SNAPSHOT` in the `versioning` section.
   
   This can be easily reproduced by setting up a repository that supports both snapshots and release.
   
   So suggesting to use this method (which adds an additional check) is not correct.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org