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

By | August 11, 2019


Is there a way to download dependencies from a pom.xml file to a specified folder in java? I’m able to run maven command from java and I got download messages, but I don’t know where maven stores these libraries? How can I download these dependencies to a specific folder?


Take a look at maven’s dependency plugin, specifically the
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

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *