[ https://issues.apache.org/jira/browse/SUREFIRE-1004?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16324595#comment-16324595 ]
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_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, ':' );` > 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)