Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase the number of connections in maven

Tags:

java

maven

How can I increase the number of http(s) connections a maven build will use to download and upload Artifacts from the repository (Artifactory or similar).

I have seen this page: https://maven.apache.org/guides/mini/guide-http-settings.html

But it does not say what is the parameter and syntax to set it.

I am using Apache Maven 3.6.0

like image 464
galusben Avatar asked Oct 28 '25 05:10

galusben


2 Answers

according to Maven documentation 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 following switch option to change default value:

-Dmaven.artifact.threads

for example :

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 176
Saeed Alizadeh Avatar answered Oct 30 '25 23:10

Saeed Alizadeh


There is options for maven: maven.artifact.threads for configuring parallel artifacst resolution

You can use it as is described on site: https://maven.apache.org/guides/mini/guide-configuring-maven.html

You can also add this properties to your settings.xml so will be affected for all builds:

<settings>
    <profiles>
        <profile>
            <id>props</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <maven.artifact.threads>10</maven.artifact.threads>
            </properties>
        </profile>
    </profiles>
</settings>
like image 42
Slawomir Jaranowski Avatar answered Oct 31 '25 01:10

Slawomir Jaranowski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!