1

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]

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]

Does anyone know what's wrong?

Add proxy settings:

<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>
thinwa
  • 295
  • 3
  • 9

3 Answers3

8

It is probably an NTLM proxy? If it is:

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

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

Jaap D
  • 501
  • 5
  • 18
1

As you said. You're using NetBean as IDE. please check the maven used in IDE. Maybe you are using the embedded maven plugin. then it will not work even you change the settings.xml under

/Users/username/.m2/settings.xml

jiming
  • 101
  • 8
  • after wasting 3 hours i recollected that i have pointed my maven from my eclipse IDE, so from now onwards i am able to run build from eclipse IDE but from command prompt it is giving me error mentioned below Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Failure to transfer – Mahboob Ali Aug 16 '17 at 15:52
1

Set the proxy in the settings.xml file in the $MAVEN_HOME/conf folder or whetever you are storing the settings.xml file.

In the settings.xml, add this section (it can be added anywhere inside <settings> and </settings>:

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

You can find the maven documentation on proxies here:

https://maven.apache.org/guides/mini/guide-proxies.html