maven settings

Both Maven and Gradle have to be configured individually to communicate through a proxy.

For configuring Maven, the settings.xml file in the {user.home}/.m2/ directory has to be edited. Create a new settings.xml if it does not exist. Within that file add the following tags to allow Maven to communicate through a proxy:

<settings>
<proxies>
<proxy>
<id>example</id>
<active>true</active>
<protocol>http</protocol>
<host>{IP-address of the proxy}</host>
<port>{port of the proxy}</port>
<nonProxyHosts>{excluded IP adresses}</nonProxyHosts>
</proxy>
</proxies>
</settings>

To allow communication using the https protocol, use <protocol>https</protocol> or add an additional proxy configuration for https.

To configure Gradle to communicate through a proxy, the gradle.properties file located in the {user.home}/.gradle/ directory is modified. As with Maven, if it file does not exists, create a new one. Within that file, the properties for http and https proxies can be configured using the following expressions:

systemProp.http.proxyHost= {IP-address of the proxy}
systemProp.http.proxyPort= {port of the proxy}
systemProp.http.nonProxyHost= {excluded IP adresses}

systemProp.https.proxyHost= {IP-address of the proxy}
systemProp.https.proxyPort= {port of the proxy}
systemProp.https.nonProxyHost= {excluded IP adresses}

In both Maven and Gradle configurations, the nonProxyHost property marks IP addresses which should be accessed without communicating through the proxy.

Adding different mirrors for maven / Mirror management in Apache maven

In some cases it may takes a lot of time during a maven build as it is necessary to download required dependecies from the maven central repo. Maven uses a mirror, located in California, United States for downlowding required maven dependencies during a maven bulid. Even there has been implemented a balance loader for the default maven mirror (http://repo1.maven.org) recently it might make sense to overwrite the default behavior and set the mirror manually cause of: -) A mirror is geographically closer and faster -) Use an internal mirror (e.g. repo - proxy) Maven allows different settings to improve speed and make the downloading process more efficient and fast. Depending on the workflow two different soultions can be an adequate approach for the problem, described above.
Subscribe to maven settings