How can the user-agent be changed in Maven?

走远了吗. 提交于 2019-12-22 09:49:58

问题


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.


回答1:


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>


来源:https://stackoverflow.com/questions/1561658/how-can-the-user-agent-be-changed-in-maven

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!