apache / apache/maven

[MNG-7348] maven.artifact.threads not respected in maven parallel builds.

Open
#8,093 1 comment 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Kari J. Niemi](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=karniemi)** opened **[MNG-7348](https://issues.apache.org/jira/browse/MNG-7348?redirect=false)** and commented

maven.artifact.threads=1 is not respected in maven parallel builds. Maven seems to do the downloads inside the BuilderThreads when using the 1 as the value - so with multiple build threads ("-T 1C" for example), downloads will be done in as many threads as there are BuildThreads. I confirmed this by polling the stack traces of the maven process: I saw that the Resolver/Wagon/aether was in the stack trace of multiple BuilderThreads at the same time, and there were no "resolver-x" threads at all.

The documentation for maven.artifact.thread says "Number of threads to use for uploading/downloading.": https://maven.apache.org/resolver/configuration.html

I suppose the issue is around here: https://github.com/apache/maven/blob/maven-3.6.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java#L106-L115

I'm really not a java expert, and  actually hope to be wrong about it - but to me it seems that the "maven.artifact.threads=1"-case is getting executed in the same thread, and therefore there will be as many downloading threads as there are BuildThreads?

( Background: this was the latest and maybe last miserable try to work around the bugs in parallel artifact downloads... which lead to builds failing and corrupted stuff in local maven repository )

 

---

**Affects:** 3.6.3

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.