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 get number of each day for a certain month in Java? - September 8, 2024
- How do I get operating system process information using ProcessHandle? - July 22, 2024
- How do I sum a BigDecimal property of a list of objects using Java Stream API? - July 22, 2024
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?