maven中的多个代理设置

时间:2015-04-13 11:36:30

标签: maven

我是Maven的新手,我有一个查询。是否可以在maven中配置多个代理?如果是这样的话?请回复示例。

我尝试通过在我的本地工作区中提供多个代理来找出它,但它没有工作。无处我看到正确的解释。请帮帮我。

1 个答案:

答案 0 :(得分:0)

请查看Maven网站https://maven.apache.org/settings.html

如果您想添加多个代理,则需要在标记下添加所有代理。我能够添加多个代理,它工作。

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                     http://maven.apache.org/xsd/settings-1.0.0.xsd">
 ...
 <proxies>
   <proxy>
    <id>myproxy</id>
    <active>true</active>
     <protocol>http</protocol>
     <host>proxy.somewhere.com</host>
     <port>8080</port>
    <username>proxyuser</username>
     <password>somepassword</password>
     <nonProxyHosts>*.google.com|ibiblio.org</nonProxyHosts>
    </proxy>
   <proxy>
    <id>myproxy</id>
    <active>true</active>
     <protocol>http</protocol>
     <host>proxy.example.com</host>
     <port>8080</port>
    <username>proxyuser</username>
     <password>somepassword</password>
     <nonProxyHosts>*.google.com|ibiblio.org</nonProxyHosts>
    </proxy>
 </proxies>
  ...
</settings>