Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to speed up maven artifacts downloading?

Tags:

Unfortunately the maven initial build is very slow due to artifacts downloading
f.e. I've tried to download the same jar using curl - it is 3 times faster!!!
Why? And how I can speed up it? Maybe maven has some config keys related to artifacts downloading speed?

Thank you.

like image 654
denys Avatar asked Apr 02 '12 09:04

denys


People also ask

Why is Maven download so slow?

So the most likely cause of slow downloads for maven-metadata. xml files is that one of your proxy repositories has a very slow remote. This problem will be compounded if either of the above two settings is set too low.

How long should a Maven build take?

Maven takes almost around 40 secs to build it. I have tried maven with multi threaded builds too by specifying -T and -C args for no of threads and cores to be used. But I haven't seen any significant improvement in wall time of my builds. I am using maven 3.2.

Why does Maven download dependencies every time?

When you run a Maven build, then Maven automatically downloads all the dependency jars into the local repository. It helps to avoid references to dependencies stored on remote machine every time a project is build. Maven local repository by default get created by Maven in %USER_HOME% directory.


1 Answers

I know its an old question, but stumbled here from Google. I already had proxy in place, just needed to speed up with concurrent downloads. You can using mvn option:

-Dmaven.artifact.threads=30

Source: https://maven.apache.org/guides/mini/guide-configuring-maven.html

Configuring Parallel Artifact Resolution By default, Maven 2.1.0+ will download up to 5 artifacts (from different groups) at once. To change the size of the thread pool, start Maven using -Dmaven.artifact.threads. For example, to only download single artifacts at a time:  mvn -Dmaven.artifact.threads=1 verify You may wish to set this option permanently, in which case you can use the MAVEN_OPTS environment variable. For example:  export MAVEN_OPTS=-Dmaven.artifact.threads=3 
like image 55
mushipao Avatar answered Oct 06 '22 02:10

mushipao