由于代理/内部网限制,在Eclipse中创建Maven项目时出错

时间:2019-06-07 00:09:12

标签: java eclipse maven proxy

在限制某些站点的Intranet连接环境中工作之前,有没有人遇到过这种情况。 在Eclipse的哪里添加代理设置?

在这里?

enter image description here

还是这里? http://maven.apache.org/xsd/settings-1.0.0.xsd“>

<!-- 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>

我不能使用pom.xml下载Maven依赖项,因为Eclipse / Maven似乎无法下载Im怀疑是由于Intranet代理设置引起的必要文件。

1 个答案:

答案 0 :(得分:3)

是的,可以在settings.xml中添加。 例如 $ {user.home} /。m2 / settings.xml

<settings>
  <proxies>
     <proxy>
           <id>web-proxy</id>
         <active>true</active>
       <protocol>http</protocol>
             <host>local.net</host>
           <port>8080</port>
       </proxy>
         </proxies>
 </settings>