如何在Maven中更改用户代理?

如何在Maven中更改用户代理?

问题描述:

如何在Maven中更改用户代理?我需要能够更改此设置以通过公司防火墙.我正在使用2.2.1版,并且注意到2.0.10发行说明中有一个改进:

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]-为Maven HTTP请求设置用户代理.

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

Brett Porter在

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>