3

如何更改 Maven 中的用户代理?我需要能够更改它以通过公司防火墙。我使用的是 2.2.1 版本,我注意到 2.0.10 发行说明中的​​改进:

[MNG-3652] - 为 Maven HTTP 请求设置用户代理。

4

2 回答 2

7

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>
于 2009-10-13T19:09:49.563 回答
0

对于命令行版本尝试

"-Daether.connector.userAgent=your custom user agent"
于 2020-03-05T08:44:02.150 回答