下载了 maven 工具,准备在 cmd 下使用 mvn 构建 maven 工程时,提示连接出错。花了几分钟 bing 了一番(google 服务最近不稳定,发现 bing 是个不错的替代品~ 对了,用 bing 的时候关键词如果是英文,记得尽量使用英文搜索),最后还是 StackOverFlow [1] 上找到了答案。
解决方法很简单,只需要修改 maven 路径下的 conf/settings.xml 文件。
默认的 proxy 代理配置(apache-maven-2.2.1)如下:
<!-- 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>proxy