Skip to content
Jens Jäger

Configuring a proxy for maven

This post is part of the archive. It was written years ago, so some of the tools, versions and links may be outdated.

To use a proxy for your maven builds just a this to your ~/.m2/settings.xml:

<settings>
  .
  .
  <proxies>
    <proxy>
      <id>http</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>username</username>
      <password>secret</password>
      <host>your.fancy.proxy.com</host>
      <port>4221</port>
      <nonproxyhosts>local.net|some.host.com</nonproxyhosts>
    </proxy>
    <proxy>
      <id>https</id>
      <active>true</active>
      <protocol>https</protocol>
      <username>username</username>
      <password>secret</password>
      <host>your.fancy.proxy.com</host>
      <port>4221</port>
      <nonproxyhosts>local.net|some.host.com</nonproxyhosts>
    </proxy>
  </proxies>
.
.
</settings>

See also the guide to using proxies in the maven documentation.