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

问题描述 投票:3回答:2

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

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

maven-2 user-agent
2个回答
7
投票

[Brett Porter在Configuring Maven HTTP Connections上发布了一个博客,描述了如何执行此操作以及其他一些时髦的事情:

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

0
投票

对于命令行版本尝试

"-Daether.connector.userAgent=your custom user agent"
© www.soinside.com 2019 - 2024. All rights reserved.