arturobernalg opened a new pull request, #1772:
URL: https://github.com/apache/maven-dependency-plugin/pull/1772

   Adds an `artifact` parameter to `copy-dependencies`: a 
`groupId:artifactId:version[:packaging[:classifier]]` coordinate resolved, 
together with its transitive dependencies, directly through the repository 
system instead of this project's own dependencies.
   
   Fixes #1239. Today, getting a dependency's jars into a directory without a 
Maven project means writing a throwaway pom.xml that declares the one 
dependency, running `copy-dependencies`, then deleting the pom. With `artifact` 
set, the goal no longer requires a `pom.xml` at all, so it can be run directly 
from the command line, e.g. `mvn dependency:copy-dependencies 
-Dartifact=groupId:artifactId:version -DoutputDirectory=libs`. The existing 
project-based behavior is unchanged when the parameter is not set.
   
   The implementation reuses the `ResolverUtil`/`ParamArtifact` machinery that 
`dependency:get` already uses to resolve a single coordinate without a project, 
so there is no new parsing or resolution logic. `excludeTransitive` is honored: 
when set, only the requested artifact itself is copied, not its dependencies.
   
   Tested with the full module suite plus two manual runs with no pom.xml 
present: `-Dartifact=junit:junit:4.13.2` copies both `junit-4.13.2.jar` and 
`hamcrest-core-1.3.jar`, and adding `-DexcludeTransitive=true` copies only the 
former. A normal project-based `copy-dependencies` run was also re-checked to 
confirm `requiresProject = false` does not change existing behavior when a 
`pom.xml` is present.
   
   I hereby declare this contribution to be licensed under the Apache License 
Version 2.0, January 2004


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to