Skip to content
 

Maven failing to download dependencies

Recently I’ve been using Maven for the dependency management of Java projects. When trying to build projects from the command line I found Maven had problems downloading certain files… it would stop at a certain point consistently and refuse to go any further. The fix I found, thanks to the ever useful StackOverflow, was to add the following option to your mvn command call:

-Djava.net.preferIPv4Stack=true

I think this a bug which occurs when using certain versions of the JVM and Maven together, which at a guess would be due to the implementation of the IPv6 stack in the JVM. Whatever it is, blogging this cure will hopefully save some of the Maven-ites out there some time!

Leave a Reply