[Commented] (SUREFIRE-1004) Enhance pattern/wildcard capabilities for dependenciesToScan to GAVT

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Commented] (SUREFIRE-1004) Enhance pattern/wildcard capabilities for dependenciesToScan to GAVT

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/SUREFIRE-1004?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16324591#comment-16324591 ]

ASF GitHub Bot commented on SUREFIRE-1004:
------------------------------------------

Github user Tibor17 commented on a diff in the pull request:

    https://github.com/apache/maven-surefire/pull/173#discussion_r161333588
 
    --- Diff: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DependencyScanner.java ---
    @@ -111,19 +112,46 @@ private static void scanArtifact( File artifact, TestFilter<String, String> filt
             {
                 for ( String groups : groupArtifactIds )
                 {
    +                // groupId:artifactId[:version[:type[:classifier]]]
                     String[] groupArtifact = groups.split( ":" );
    -                if ( groupArtifact.length != 2 )
    +                if ( groupArtifact.length < 2 || groupArtifact.length > 5 )
                     {
                         throw new IllegalArgumentException( "dependencyToScan argument should be in format"
    -                        + " 'groupid:artifactid': " + groups );
    +                        + " 'groupid:artifactid[:version[:type[:classifier]]]': " + groups );
                     }
    -                if ( artifact.getGroupId().matches( groupArtifact[0] )
    -                    && artifact.getArtifactId().matches( groupArtifact[1] ) )
    +                if ( artifactMatchesGavtc( artifact, groupArtifact ) )
                     {
                         matches.add( artifact.getFile() );
                     }
                 }
             }
             return matches;
         }
    +    
    +    private static boolean artifactMatchesGavtc( Artifact artifact, String[] gavtc )
    +    {
    +        boolean match = false;
    +        if ( artifact.getGroupId().matches( gavtc[0] ) && artifact.getArtifactId().matches( gavtc[1] ) )
    +        {
    +            match = true;
    +            // Check version
    +            if ( match && gavtc.length > 2 )
    --- End diff --
   
    Did you mean `>=`?


> Enhance pattern/wildcard capabilities for dependenciesToScan to GAVT
> --------------------------------------------------------------------
>
>                 Key: SUREFIRE-1004
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1004
>             Project: Maven Surefire
>          Issue Type: Improvement
>          Components: Maven Failsafe Plugin, Maven Surefire Plugin
>    Affects Versions: 2.15
>            Reporter: Andreas Gudian
>
> * Enhance what has been built with SUREFIRE-569 to support patterns as in maven-shade-plugin. Use maven-common-artifact-filters for that.
> * Add/Adapt documentation and examples.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)