如何设置Maven代理 [英] How to set maven proxy

查看:127
本文介绍了如何设置Maven代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我在代理后面,因此我尝试在NetBeans 7.4中设置Maven代理.我在NetBeans的工具">选项">常规">代理设置"中设置了代理,它工作正常.但是当我尝试构建项目时,仍然出现错误.

I tried to set maven proxy in NetBeans 7.4 since I am behind a proxy. I setup the proxy in NetBeans from Tools>Options>General>Proxy Settings, and it's working fine. But I still getting error when I was trying to build my project.

Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org -> [Help 1]

我搜索了错误消息,然后在maven的settings.xml文件中设置了相同的代理,但是再次发生错误.

I googled the error message, and then setup the the same proxy in settings.xml file of maven, but error occurs again.

Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http://repo.maven.apache.org/maven2): Not authorized by proxy , ReasonPhrase:Proxy Authentication Required. -> [Help 1]

有人知道怎么了吗?

添加代理设置:

<proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |-->
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxyhost</host>
      <port>8080</port>
      <nonProxyHosts>localhost|*.google.com.*</nonProxyHosts>
    </proxy>
       </proxies>

推荐答案

它可能是NTLM代理吗?如果是这样:

It is probably an NTLM proxy? If it is:

从以下位置下载wagon-http-lightweight-2.2.jar http://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-http-lightweight/2.2/wagon-http-lightweight-2.2.jar

Download the wagon-http-lightweight-2.2.jar from http://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-http-lightweight/2.2/wagon-http-lightweight-2.2.jar

将wagon-http-lightweight-2.2.jar复制到%M2_HOME%/lib/ext文件夹.

Copy the wagon-http-lightweight-2.2.jar to %M2_HOME%/lib/ext folder.

这篇关于如何设置Maven代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆