To enable proxy access in Maven, define the proxy server detail in {MAVEN_HOME}/conf/settings.xml
Note
There is a high chance your company is set up an HTTP proxy server to stop user connecting to the Internet directly. If you are behind a proxy, Maven will fail to download the project dependencies.
P.S Tested with Maven 3.6
1. Proxy Access
1. Open the Maven settings.xml
, find proxies
tag :
{MAVEN_HOME}/conf/settings.xml
<!-- proxies | This is a list of proxies which can be used on this machine to connect to the network. | Unless otherwise specified (by system property or command-line switch), the first proxy | specification in this list marked as active will be used. |--> <proxies> <!-- proxy | Specification for one proxy, to be used in connecting to the network. | <proxy> <id>optional</id> <active>true</active> <protocol>http</protocol> <username>proxyuser</username> <password>proxypass</password> <host>proxy.host.net</host> <port>80</port> <nonProxyHosts>local.net|some.host.com</nonProxyHosts> </proxy> --> </proxies>
1.2 Defined the proxy server setting like below :
<proxies> <!-- proxy | Specification for one proxy, to be used in connecting to the network. | <proxy> <id>optional</id> <active>true</active> <protocol>http</protocol> <username>proxyuser</username> <password>proxypass</password> <host>proxy.host.net</host> <port>80</port> <nonProxyHosts>local.net|some.host.com</nonProxyHosts> </proxy> --> <proxy> <id>optional</id> <active>true</active> <protocol>http</protocol> <username>favtuts</username> <password>password</password> <host>proxy.tuts.heomi.net</host> <port>8888</port> <nonProxyHosts>local.net|some.host.com</nonProxyHosts> </proxy> </proxies>
1.3 Done, the Apache Maven should be able to connect to the Internet via the proxy server.