How to use Maven pom to download jar files only to a specific directory?

Take a look at maven’s dependency plugin, specifically the
copy-dependencies goal. The usage section describes how to do exactly what you want.

To do it from the command line just do:

$ mvn dependency:copy-dependencies -DoutputDirectory=OUTPUT_DIR

Add this to exclude the transitive or inner dependencies:

-DexcludeTransitive=true

Leave a Comment