Configuring a Proxy Server in Maven

Login | Register

Configuring a Proxy Server in Maven

Maven

To configure a proxy server in Maven 2 or Maven 3, edit the settings.xml file and configure the <proxies> section.

The settings.xml file is located at: ${userhome}/.m2/settings/xml.

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://maven.apache.org/SETTINGS/1.0.0
  http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <proxies>
    <proxy>
      <id>defaultProxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>default.proxy.server.host</host>
      <port>8080</port>
      <username>default.proxy.user</username>
      <password>secret</password>
      <nonproxyhosts>*.acme.com|*.acme.org</nonproxyhosts>
    </proxy>
  </proxies>
</settings>

About

At Develop In Java, we've been a part of the Java community for over 10 years. If there's anything you'd like us to cover, just ask !

Current versions

  • Java - 1.8
  • Java EE - 7
  • Spring - 4.x