You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2022/07/15 21:50:13 UTC

[maven-common-artifact-filters] branch gatv-or-gatc created (now a9e2a6d)

This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a change to branch gatv-or-gatc
in repository https://gitbox.apache.org/repos/asf/maven-common-artifact-filters.git


      at a9e2a6d  GATV or GATC

This branch includes the following new commits:

     new a9e2a6d  GATV or GATC

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-common-artifact-filters] 01/01: GATV or GATC

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a commit to branch gatv-or-gatc
in repository https://gitbox.apache.org/repos/asf/maven-common-artifact-filters.git

commit a9e2a6d039d74b11f5a1f01dca8974cb199441d8
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Fri Jul 15 23:49:40 2022 +0200

    GATV or GATC
    
    This simple patch makes 4 element pattern
    be interpeted as GATV (as before) or as GATV
---
 .../shared/artifact/filter/PatternIncludesArtifactFilter.java | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/PatternIncludesArtifactFilter.java b/src/main/java/org/apache/maven/shared/artifact/filter/PatternIncludesArtifactFilter.java
index b44e6c3..0bccb19 100644
--- a/src/main/java/org/apache/maven/shared/artifact/filter/PatternIncludesArtifactFilter.java
+++ b/src/main/java/org/apache/maven/shared/artifact/filter/PatternIncludesArtifactFilter.java
@@ -20,6 +20,7 @@ package org.apache.maven.shared.artifact.filter;
  */
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.EnumSet;
 import java.util.HashMap;
@@ -364,11 +365,11 @@ public class PatternIncludesArtifactFilter implements ArtifactFilter, Statistics
             }
             else if ( tokens.length == 4 )
             {
-                // trivial, full pattern w/o classifier: G:A:T:V
+                // trivial, full pattern w/o classifier: G:A:T:V or G:A:T:C
                 patterns.add( toPattern( tokens[0], Coordinate.GROUP_ID ) );
                 patterns.add( toPattern( tokens[1], Coordinate.ARTIFACT_ID ) );
                 patterns.add( toPattern( tokens[2], Coordinate.TYPE ) );
-                patterns.add( toPattern( tokens[3], Coordinate.BASE_VERSION ) );
+                patterns.add( toPattern( tokens[3], Coordinate.CLASSIFIER, Coordinate.BASE_VERSION ) );
             }
             else if ( tokens.length == 3 )
             {
@@ -481,7 +482,7 @@ public class PatternIncludesArtifactFilter implements ArtifactFilter, Statistics
         }
     }
 
-    private static Pattern toPattern( final String token, final Coordinate coordinate )
+    private static Pattern toPattern( final String token, final Coordinate... coordinate )
     {
         if ( ANY.equals( token ) )
         {
@@ -489,7 +490,9 @@ public class PatternIncludesArtifactFilter implements ArtifactFilter, Statistics
         }
         else
         {
-            return new CoordinateMatchingPattern( token, token, EnumSet.of( coordinate ) );
+            EnumSet<Coordinate> coordinates = EnumSet.noneOf( Coordinate.class );
+            coordinates.addAll( Arrays.asList( coordinate ) );
+            return new CoordinateMatchingPattern( token, token, coordinates );
         }
     }