[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17738903#comment-17738903 ] ASF GitHub Bot commented on SUREFIRE-2179: -- kwin merged PR #667: URL: https://github.com/apache/maven-surefire/pull/667 > 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)
[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17738446#comment-17738446 ] ASF GitHub Bot commented on SUREFIRE-2179: -- cstamas commented on code in PR #667: URL: https://github.com/apache/maven-surefire/pull/667#discussion_r1246349148 ## maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java: ## @@ -281,6 +285,26 @@ public abstract class AbstractSurefireMojo extends AbstractMojo implements Suref @Parameter(property = "maven.test.additionalClasspath") private String[] additionalClasspathElements; +/** + * Additional Maven dependencies to be used in the test execution classpath. Review Comment: LGTM > 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)
[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17738441#comment-17738441 ] ASF GitHub Bot commented on SUREFIRE-2179: -- kwin commented on code in PR #667: URL: https://github.com/apache/maven-surefire/pull/667#discussion_r1246327954 ## maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java: ## @@ -281,6 +285,26 @@ public abstract class AbstractSurefireMojo extends AbstractMojo implements Suref @Parameter(property = "maven.test.additionalClasspath") private String[] additionalClasspathElements; +/** + * Additional Maven dependencies to be used in the test execution classpath. Review Comment: ```suggestion * Additional Maven dependencies to be added to the test classpath at runtime ``` > 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)
[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17738428#comment-17738428 ] ASF GitHub Bot commented on SUREFIRE-2179: -- cstamas commented on PR #667: URL: https://github.com/apache/maven-surefire/pull/667#issuecomment-1612603986 In fact, IMHO we should revisit ALL these plugins having "artifact-like" (GAV) parameters and using resolver to resolve them, and * mark all these configurations as "usable for out-of-reactor plugins only" (or it is user who needs to hack in proper build order by whatever means he can) * come up with some proper solution in Maven to make sorting aware of ALL these Biggest problem is that "by chance" the ordering may be good, and seemingly everything works, but then user changes something completely unrelated (ie. adds a new module to build), that changes build order, and suddenly this breaks. In this situations is hard to figure out why breakage happened. > 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)
[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17738425#comment-17738425 ] ASF GitHub Bot commented on SUREFIRE-2179: -- cstamas commented on PR #667: URL: https://github.com/apache/maven-surefire/pull/667#issuecomment-1612598248 For all non POM/dependency and POM/plugins/plugin/dependency elements, especially for plugin config like this one (or like compiler anno processor is, etc) we MUST BE CLEAR that it works ONLY for _external dependencies_. These elements do NOT participate in project topological sorting, hence, becomes impossible to use some reactor project for these (without hacks). Moreover, if using reactor artifacts, this is one of the reasons why users are forced to to `mvn install` as 1st pass, and from 2nd pass onward "it will work", but again, what is being used "lags" one build cycle (as installed thing is being used, not the currently built one). See for example here https://issues.apache.org/jira/browse/MNG-6877 > 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)
[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17738381#comment-17738381 ] ASF GitHub Bot commented on SUREFIRE-2179: -- kwin commented on PR #667: URL: https://github.com/apache/maven-surefire/pull/667#issuecomment-1612522716 > is it possible to have an IT test? as I cannot see any test here. thanks Done now, you find it in https://github.com/apache/maven-surefire/pull/667/files#diff-311598b970ad59d912704889726abb7abbf6d92d3d5382a94d85c8c686ab24b9R21 > 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)
[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17738188#comment-17738188 ] ASF GitHub Bot commented on SUREFIRE-2179: -- kwin commented on code in PR #667: URL: https://github.com/apache/maven-surefire/pull/667#discussion_r1243772435 ## maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java: ## @@ -281,6 +285,21 @@ public abstract class AbstractSurefireMojo extends AbstractMojo implements Suref @Parameter(property = "maven.test.additionalClasspath") private String[] additionalClasspathElements; +/** + * Additional Maven dependencies to be used in the test execution classpath. + * Each element supports the parametrization like documented in https://maven.apache.org/pom.html#dependencies;>POM Reference: Dependencies. + * + * Those dependencies are automatically collected (i.e. have their full dependency tree calculated) and then all underlying artifacts are resolved from the repository (including their transitive dependencies). + * Afterwards the resolved artifacts are filtered to only contain {@code compile} and {@code runtime} scoped ones and appended to the test execution classpath + * (after the ones from {@link #additionalClasspathElements}). + * + * The dependency management from the project is not taken into account. + * + * @since 3.2 + */ +@Parameter(property = "maven.test.additionalClasspathDependencies") +private Dependency[] additionalClasspathDependencies; Review Comment: This is just to be more in line with existing parameters. But I can switch to `List`. The `null` check is not necessary for either array nor Collection, as plexus.inject will inject an empty array.It is only necessary for unit tests. > 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)
[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17737716#comment-17737716 ] ASF GitHub Bot commented on SUREFIRE-2179: -- olamy commented on PR #667: URL: https://github.com/apache/maven-surefire/pull/667#issuecomment-1609714887 is it possible to have an IT test? as I cannot see any test here. thanks > 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)
[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17737678#comment-17737678 ] ASF GitHub Bot commented on SUREFIRE-2179: -- kwin commented on code in PR #667: URL: https://github.com/apache/maven-surefire/pull/667#discussion_r1243772435 ## maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java: ## @@ -281,6 +285,21 @@ public abstract class AbstractSurefireMojo extends AbstractMojo implements Suref @Parameter(property = "maven.test.additionalClasspath") private String[] additionalClasspathElements; +/** + * Additional Maven dependencies to be used in the test execution classpath. + * Each element supports the parametrization like documented in https://maven.apache.org/pom.html#dependencies;>POM Reference: Dependencies. + * + * Those dependencies are automatically collected (i.e. have their full dependency tree calculated) and then all underlying artifacts are resolved from the repository (including their transitive dependencies). + * Afterwards the resolved artifacts are filtered to only contain {@code compile} and {@code runtime} scoped ones and appended to the test execution classpath + * (after the ones from {@link #additionalClasspathElements}). + * + * The dependency management from the project is not taken into account. + * + * @since 3.2 + */ +@Parameter(property = "maven.test.additionalClasspathDependencies") +private Dependency[] additionalClasspathDependencies; Review Comment: This is just to be more in line with existing parameters. But I can switch to `List`. The `null` check is not necessary for either array nor Collection, as plexus.inject will inject an empty array. > 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)
[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17737679#comment-17737679 ] ASF GitHub Bot commented on SUREFIRE-2179: -- kwin commented on code in PR #667: URL: https://github.com/apache/maven-surefire/pull/667#discussion_r1243773343 ## maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java: ## @@ -3474,6 +3552,14 @@ public void setAdditionalClasspathElements(String[] additionalClasspathElements) this.additionalClasspathElements = additionalClasspathElements; } +public Dependency[] getAdditionalClasspathDependencies() { +return additionalClasspathDependencies; +} + +public void setAdditionalClasspathDependencies(Dependency[] additionalClasspathDependencies) { +this.additionalClasspathDependencies = additionalClasspathDependencies; +} Review Comment: Right, this was again to be in line with other parameters, but agree we don't need them. > 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)
[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17737347#comment-17737347 ] ASF GitHub Bot commented on SUREFIRE-2179: -- slawekjaranowski commented on code in PR #667: URL: https://github.com/apache/maven-surefire/pull/667#discussion_r1242765457 ## maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java: ## @@ -281,6 +285,21 @@ public abstract class AbstractSurefireMojo extends AbstractMojo implements Suref @Parameter(property = "maven.test.additionalClasspath") private String[] additionalClasspathElements; +/** + * Additional Maven dependencies to be used in the test execution classpath. + * Each element supports the parametrization like documented in https://maven.apache.org/pom.html#dependencies;>POM Reference: Dependencies. + * + * Those dependencies are automatically collected (i.e. have their full dependency tree calculated) and then all underlying artifacts are resolved from the repository (including their transitive dependencies). + * Afterwards the resolved artifacts are filtered to only contain {@code compile} and {@code runtime} scoped ones and appended to the test execution classpath + * (after the ones from {@link #additionalClasspathElements}). + * + * The dependency management from the project is not taken into account. + * + * @since 3.2 + */ +@Parameter(property = "maven.test.additionalClasspathDependencies") +private Dependency[] additionalClasspathDependencies; Review Comment: `List`? with empty list as default - we will not need check for null value ## maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java: ## @@ -3474,6 +3552,14 @@ public void setAdditionalClasspathElements(String[] additionalClasspathElements) this.additionalClasspathElements = additionalClasspathElements; } +public Dependency[] getAdditionalClasspathDependencies() { +return additionalClasspathDependencies; +} + +public void setAdditionalClasspathDependencies(Dependency[] additionalClasspathDependencies) { +this.additionalClasspathDependencies = additionalClasspathDependencies; +} Review Comment: we don't use this values outside class - so getter and setter are not needed. > 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)
[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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 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 resolveDependencies(Stream 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)
[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17736482#comment-17736482 ] ASF GitHub Bot commented on SUREFIRE-2179: -- kwin commented on code in PR #667: URL: https://github.com/apache/maven-surefire/pull/667#discussion_r1239759169 ## maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java: ## @@ -281,6 +290,17 @@ public abstract class AbstractSurefireMojo extends AbstractMojo implements Suref @Parameter(property = "maven.test.additionalClasspath") private String[] additionalClasspathElements; +/** + * Maven coordinates in the format {@code :[:[:]]:} of additional artifacts. + * Those artifacts are automatically resolved from the repository (including their transitive dependencies). Review Comment: Probably mentioning the scope here ("runtime" + "compile") would make sense. > 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. Optionally this parameter should support Maven coordinates which are > then resolved automatically. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17736480#comment-17736480 ] ASF GitHub Bot commented on SUREFIRE-2179: -- kwin commented on code in PR #667: URL: https://github.com/apache/maven-surefire/pull/667#discussion_r1239758247 ## 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 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 resolveDependencies(Stream mavenCoordinates) throws MojoFailureException { Review Comment: Should we move this method and `resolveArtifact` to `SurefireDependencyResolver` instead? > 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. Optionally this parameter should support Maven coordinates which are > then resolved automatically. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17736476#comment-17736476 ] ASF GitHub Bot commented on SUREFIRE-2179: -- kwin opened a new pull request, #667: URL: https://github.com/apache/maven-surefire/pull/667 (no comment) > 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. Optionally this parameter should support Maven coordinates which are > then resolved automatically. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (SUREFIRE-2179) additionalClasspathElements should support Maven coordinates
[ https://issues.apache.org/jira/browse/SUREFIRE-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17736025#comment-17736025 ] Konrad Windszus commented on SUREFIRE-2179: --- Maybe also supporting wildcards in the same way as documented in https://docs.oracle.com/javase/8/docs/technotes/tools/windows/classpath.html#A1100762 makes sense here as well (in case a dedicated directory is populated with JAR files through another goal). > 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 >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. Optionally this parameter should support Maven coordinates which are > then resolved automatically. -- This message was sent by Atlassian Jira (v8.20.10#820010)