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

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

kwin commented on code in PR #667:
URL: https://github.com/apache/maven-surefire/pull/667#discussion_r1242114688


##########
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java:
##########
@@ -2542,8 +2563,57 @@ private TestClassPath generateTestClasspath() {
             classpathArtifacts = filterArtifacts(classpathArtifacts, 
dependencyFilter);
         }
 
+        Set<String> additionalClasspathElements = new HashSet<>();
+        if (getAdditionalClasspathElements() != null) {
+            
Arrays.stream(getAdditionalClasspathElements()).forEach(additionalClasspathElements::add);
+        }
+        if (getAdditionalClasspathArtifacts() != null) {
+            
resolveDependencies(Arrays.stream(getAdditionalClasspathArtifacts())).stream()
+                    .map(File::getAbsolutePath)
+                    .forEach(additionalClasspathElements::add);
+        }
         return new TestClassPath(
-                classpathArtifacts, getMainBuildPath(), 
getTestClassesDirectory(), getAdditionalClasspathElements());
+                classpathArtifacts, getMainBuildPath(), 
getTestClassesDirectory(), additionalClasspathElements);
+    }
+
+    Set<File> resolveDependencies(Stream<String> mavenCoordinates) throws 
MojoFailureException {

Review Comment:
   Done





> additionalClasspathElements should support Maven coordinates
> ------------------------------------------------------------
>
>                 Key: SUREFIRE-2179
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-2179
>             Project: Maven Surefire
>          Issue Type: Improvement
>          Components: classloading
>    Affects Versions: 3.1.2
>            Reporter: Konrad Windszus
>            Assignee: Konrad Windszus
>            Priority: Major
>
> Currently the parameter {{additionalClasspathElements}} 
> (https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#additionalclasspathelements)
>  only supports file paths. That usually requires to add an additional step to 
> first download the necessary artifact to a temporary folder with another 
> Mojo. In addition {{additionalClasspathElements}} only support full paths to 
> JARs but no wildcards which makes configuration very verbose.
> For these reasons there should be an additional parameter supporting Maven 
> coordinates which are then resolved automatically (even transitively) and 
> added to the test execution classpath.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to