Last Updated: February 25, 2016
·
1.176K
· jreijn

Building with an empty Maven repository

It might occur that a Maven build fails on somebody else his machine due a missing dependency. To figure out why the artifact lives in your own repository it can be useful to start with an empty maven repository.

I've seen developers throw away their entire Maven repository or move it to a different location, but maven has support for this out of the box. Simply use:

$ mvn clean package -Dmaven.repo.local=/tmp/temp-repo

and watch maven download all the necessary artifacts. That's it!