Article updated on

How to use maven just to copy dependencies

Maven is one of the best java applications used to build and deploy Java Projects but sometimes we may just need to use it to manage or download dependencies which is probably its best feature. In this example I'm using Linux Ubuntu to download several jars to a folder.

1 - First make sure you have installed maven.

From the console type: mvn -version

2 - Create a pom.xml file in the parent folder for the folder you wish to download all the libraries

Use this pom.xml as template.

<project xmlns="" xmlns:xsi=""
                                    <!-- hardcode values, or use properties, depending on what you want
                                        to do -->
                                    <type>[ packaging ]</type>
                            <!-- other configurations here -->


* In this example I'm downloading some core Spring libraries.

3 - Execute the command to download the libraries.

Create a folder in which you want to download all the libraries specified in the pom.xml in this example I created a folder called lib.

Execute the following command in the console.

mvn dependency:copy-dependencies -DoutputDirectory=yourfoldername

4 - Verify that the libraries are there.

5 - Configure your proxy (If needed)

Go to your maven installation folder  /conf/settings.xml (create it if it doesn't exist) and use the following as template.




  • I am using the maven-dependency-plugin
  • You can integrate this example with Eclipse, I does not produce any syntax erroros nevertheless, it is not possible to run it with the eclipse maven plug-in so far.