Search code examples
maven-2user-agent

How can the user-agent be changed in Maven?


How can I change the user-agent in Maven? I need to be able to change this to get through the company firewall. I am using version 2.2.1 and I noticed an improvement in the 2.0.10 release notes:

[MNG-3652] - set a user agent for Maven HTTP requests.


Solution

  • Brett Porter posted a blog on Configuring Maven HTTP Connections that describes how you can do this and some other funky things:

    <server>
      <id>archiva.localhost</id>
      <configuration>
        <httpHeaders>
          <property>
            <name>User-Agent</name>
            <value>Internal-Build-System/1.0</value>
          </property>
        </httpHeaders>
      </configuration>
    </server>