Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parallel downloads of Maven artifacts

Tags:

maven

When building a project with dependencies not yet available in the local repository, I noticed that Maven 3.3.3 first downloads the dependency POMs sequentially and then proceeds with downloading the dependency JARs with up to 5 threads in parallel.

What's the reason for not using parallel downloads for the POMs also?

Is there an option to configure the number of parallel downloads of either POMs or JARs?

like image 526
Harald Wellmann Avatar asked Aug 30 '15 18:08

Harald Wellmann


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.

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.

How do I download Maven dependencies again?

In Maven, you can use Apache Maven Dependency Plugin, goal dependency:purge-local-repository to remove the project dependencies from the local repository, and re-download it again.


2 Answers

It's not possible with current version of Maven, 3.8.1.

OP has created an issue for this and a PR for it (this is the 3rd try for adding this feature) and it has been merged to Maven Resolver (a Maven library) in April 2019.

However in July 2019 it has been reverted so I don't know when will this land in a Maven release.

like image 143
Greg Dubicki Avatar answered Nov 10 '22 07:11

Greg Dubicki


What about maven.artifact.threads config variable ?

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

like image 28
Realn0whereman Avatar answered Nov 10 '22 08:11

Realn0whereman