When we work behind a proxy server, we need to configure Maven to be able to connect to the internet. To enable proxy we can configure Maven settings.xml
file, either in ${M2_HOME}/conf/settings.xml
or ${user.home}/.m2/settings.xml
file.
<?xml version="1.0" encoding="UTF-8"?>
<settings>
.
.
<proxies>
<proxy>
<id>my-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.org</host>
<port>8080</port>
<username>username</username>
<password>password</password>
<nonProxyHosts>*.example.org|*.example.com</nonProxyHosts>
</proxy>
</proxies>
.
.
</settings>
The <proxy>
element in the configuration above contains the information about the proxy server. These include information about the host
, port
, username
and password
. Set these elements to match your proxy server configuration.
Latest posts by Wayan (see all)
- How do I iterate through date range in Java? - October 5, 2023
- How do I create a string of repeated characters? - September 1, 2023
- How do I convert datetime string with optional part to a date object? - August 28, 2023
Pak klo sudah coba beberapa proxy tapi maven tetap gak bisa konek apa yg kliru pak ya? makasih.
Halo,
Error-nya seperti apa ya Mas? Bisa ditunjukin gak error stacktrace-nya?