Harald Wellmann
Harald Wellmann

Reputation: 12865

Parallel downloads of Maven artifacts

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?

Upvotes: 57

Views: 18473

Answers (3)

user12996442
user12996442

Reputation: 41

Artifacts(jars) are downloaded in parallel by default however poms are not.

Starting mave 3.9.0, using -Daether.dependencyCollector.impl=bf, poms will be downloaded in parallel in 5 threads, if you want to download with more threads, use -Daether.dependencyCollector.impl=bf -Dmaven.artifact.threads=10. In such case, both poms and artifacts will be downloaded in parallel.

You can share more feedback to below JIRA so we can convince Maven community to make bf as default. https://issues.apache.org/jira/browse/MRESOLVER-324

Upvotes: 4

Tillerino
Tillerino

Reputation: 738

Since Maven 3.9.0, this is finally possible. The interesting bit in the release notes is

Choice of resolver collectors: a new BF collector (with parallel POM downloads) has been added along the existing DF one.

Everything is a bit hidden away, but here are clear directions:

Add -Daether.dependencyCollector.impl=bf to your maven invocation to switch from depth-first (DF) to breadth-first (BF) dependency collection. This means that POMs will also be downloaded in parallel.

It looks from that issue that it is planned to make this the default mode.

Upvotes: 26

Realn0whereman
Realn0whereman

Reputation: 1226

What about maven.artifact.threads config variable ?

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

Upvotes: 10

Related Questions