文档说明: Maven 启用代理访问
01. 使用背景
如果公司建立了一个使用HTTP代理服务器来阻止用户直接连接到互联网的防火墙。如果不使用代理,Maven将无法下载任何依赖。 为了使它正常工作,必须将代理服务器声明在 Maven 的配置文件(settings.xml)中.
02. 操作指南
找到文件 {MAVEN_HOME}/conf/settings.xml, 并把代理服务器配置信息写入。settings.xml中的原始代理配置信息如下:
注:{MAVEN_HOME} => D:\software\yiibai.com\apache-maven
<!-- 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>
<!-- 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>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>yiibai</username>
<password>password</password>
<host>proxy.yiibai.com</host>
<port>8888</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>
B. 保存配置文件
完成后,Maven 应该是能够通过代理服务器立即连接到Internet。