Herve Boutemy created MDEP-749:
----------------------------------
Summary: copy-dependencies fails when using excludeScopes if
result is empty
Key: MDEP-749
URL: https://issues.apache.org/jira/browse/MDEP-749
Project: Maven Dependency Plugin
Issue Type: Bug
Components: copy-dependencies
Affects Versions: 3.1.2
Reporter: Herve Boutemy
Fix For: 3.2.0
{{mvn dependency:copy-dependencies}} works well even if a POM does not have any
dependencies
but {{mvn dependency:copy-dependencies -DexcludeScope=test}} fails if the
result is empty (either because it was empty without the exclusion, or because
the exclusion removed every existing dependency, like in this case if junit was
a test scoped dependency)
{noformat}$ mvn dependency:copy-dependencies -DexcludeScope=test
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< com.sonatype:dep-scope-test >---------------------
[INFO] Building dep-scope-test 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:copy-dependencies (default-cli) @
dep-scope-test ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.765 s
[INFO] Finished at: 2021-05-20T08:21:16+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-dependency-plugin:2.8:copy-dependencies
(default-cli) on project dep-scope-test: Can't exclude Test scope, this will
exclude everything. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
{noformat}
can be done easily on a project created with {{mvn archetype:generate
-DgroupId=com.sonatype -DartifactId=dep-scope-test
-DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4
-DinteractiveMode=false}}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)