一:背景
1 2 3
| 由于maven下载pom中的jar可能会受到网络限制的影响造成 无法下载,所以需要设置一下代理,本文就介绍如何设置 socks5代理。
|
二:设置方式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| 在maven根目录/bin下创建setting.xml文件,并写入如何内容:
<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository /> <interactiveMode /> <usePluginRegistry /> <offline /> <pluginGroups /> <servers /> <proxies> <!-- 使用代理上网 --> <proxy> <id>optional</id> <active>true</active> <protocol>socks5</protocol> <username></username> <password></password> <host>hk1.matchcess.com</host> <port>8627</port> <!-- 无需使用代理访问的地址 --> <nonProxyHosts>localhost|127.0.0.1|baidu.com</nonProxyHosts> </proxy> </proxies> <profiles /> <activeProfiles /> </settings>
|
三:参数说明
设定项 |
说明 |
id |
proxy的id,proxy可以有多个,根据id唯一确认proxy |
active |
多个proxy,active的只能有一个,根据此项进行设定 |
protocol |
协议,可设定为https或者http以及socks5等 |
username |
proxy的用户名,没有的无需设定 |
password |
proxy的用户密码,没有的无需设定 |
host |
proxy的IP或者访问地址 |
port |
proxy的port端口 |
nonPorxyHosts |
无需使用代理访问的地址 |
*************感谢您的阅读*************