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

    https://github.com/apache/maven-surefire/pull/173#discussion_r161333957
  
    --- 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 --
    
    Because I have proposed this method has only one parameter `( String groups 
)` you can use our utility:
    `String[] gavtc = StringUtils.split( groups, ':' );`


---

Reply via email to