如何设置maven代理

如何设置maven代理,maven,proxy,Maven,Proxy,我试图在NetBeans 7.4中设置maven代理,因为我在代理后面。我从工具>选项>常规>代理设置在NetBeans中设置代理,它工作正常。但当我试图构建我的项目时,仍然会出错 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.

我试图在NetBeans 7.4中设置maven代理,因为我在代理后面。我从工具>选项>常规>代理设置在NetBeans中设置代理,它工作正常。但当我试图构建我的项目时,仍然会出错

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文件中设置了相同的代理,但错误再次发生

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>

可选择的
符合事实的
http
代理主机
8080
localhost |*.google.com*

它可能是NTLM代理?如果是:

从下载wago-http-lightweight-2.2.jar


将wago-http-lightweight-2.2.jar复制到%M2\u HOME%/lib/ext文件夹。

它可能是NTLM代理?如果是:

从下载wago-http-lightweight-2.2.jar


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

如您所说。您正在使用NetBean作为IDE。请检查IDE中使用的maven。也许您正在使用嵌入式maven插件。那么,即使您在下更改settings.xml,它也不会起作用

/Users/username/.m2/settings.xml


正如你所说。您正在使用NetBean作为IDE。请检查IDE中使用的maven。也许您正在使用嵌入式maven插件。那么,即使您在下更改settings.xml,它也不会起作用

/Users/username/.m2/settings.xml


在$MAVEN_HOME/conf文件夹的settings.xml文件中或在存储settings.xml文件时设置代理

在settings.xml中,添加此部分(可以在
中的任何位置添加此部分):


示例代理

在$MAVEN_HOME/conf文件夹的settings.xml文件中设置代理,或者在存储settings.xml文件时设置代理

在settings.xml中,添加此部分(可以在
中的任何位置添加此部分):


示例代理

请发布您的maven本地存储库设置。添加了xmlProxy设置。请发布您的maven本地存储库设置。添加了xmlProxy设置。浪费了3个小时后,我回忆起我已经从eclipse IDE中指向了我的maven,因此从现在起,我可以从eclipse IDE运行build,但从命令提示符中,它会提示我错误下面的ed是由以下原因引起的:org.eclipse.aether.transfer.ArtifactTransferException:传输失败浪费了3个小时后,我记得我已经从eclipse IDE指向了我的maven,所以从现在起,我可以从eclipse IDE运行build,但从命令提示符下,它给了我下面提到的错误:org.eclipse.aether.transfer.ArtifactTransferException:无法传输
<proxies>
 <proxy>
    <id>example-proxy</id>
    <active>true</active>
    <protocol>http</protocol>
    <host>172.20.201.42</host>   <!-- add your proxy host IP here -->
    <port>8080</port> <!-- add your proxy host port here -->
    <nonProxyHosts>  <!-- non proxy hosts separated by | (pipe) character -->
      172.*|10.*
    </nonProxyHosts>
  </proxy>
</proxies>