Maven启动代理访问

来源:互联网 发布:ours 乐队知乎 编辑:程序博客网 时间:2024/06/18 13:07

如果你的公司正在建立一个防火墙,并使用HTTP代理服务器来阻止用户直接连接到互联网。如果您使用代理,Maven将无法下载任何依赖。

解决方法:Maven 的配置文件中设置代理服务器:settings.xml.

<!-- proxies   | This is a list of proxies which can be used on this machine to connect to the network.   | Unless otherwise specified (by system property or command-line switch), the first proxy   | specification in this list marked as active will be used.   |-->  <proxies>    <!-- proxy     | Specification for one proxy, to be used in connecting to the network.     |    <proxy>      <id>optional</id>      <active>true</active>      <protocol>http</protocol>      <username>proxyuser</</username>      <password>proxypass</password>      <host>proxy.host.net</host>      <port>80</port>      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>    </proxy>    -->  </proxies>
取消注释选项,填写自己代理的详细信息,保存即可。

原创粉丝点击