By default, Maven 2.1.0 and above will download up to five artifacts at a time. There is no need to add any additional configuration to enable this new feature.
At present, it will only download artifacts from different groups simultaneously. This limit was made to prevent potential sequencing issues. This may be enhanced in a later version of Maven, however at present it limits the possible performance gains by raising the number of parallel downloads. The main gains will be when there are a number of large artifacts to download, or when the local repository is regularly cleaned.
Note
Even with a repository manager very close by caching artifacts, parallel downloads can improve performance in retrieving the artifacts with a clean repository.
It is possible to change the number of active download threads, which is useful if you wish to try to add a minimal amount more performance, or if you need to limit the resources used by the Maven process.
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 clean install
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
Such an option may be considered within your build server. In Continuum, this can be added to a build definition via an installation environment variable. See Installations in Chapter 8, Continuum: Ensuring the Health of your Source Code for an example of configuring MAVEN_OPTS
in Continuum.