Caused org apache maven wagon TransferFailedException

Caused org apache maven wagon TransferFailedException

If you are getting below exception while trying to run mvn command from window command prompt:

Caused by: java.net.UnknownHostException: proxy.host.net
        at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
        at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
        at java.net.InetAddress.getAllByName0(InetAddress.java:1246)
        at java.net.InetAddress.getAllByName(InetAddress.java:1162)
        at java.net.InetAddress.getAllByName(InetAddress.java:1098)
        at org.apache.maven.wagon.providers.http.httpclient.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:44)
        at org.apache.maven.wagon.providers.http.httpclient.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:101)
        at org.apache.maven.wagon.providers.http.httpclient.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
        at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:371)
        at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
        at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
        at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec.execute(RetryExec.java:86)
        at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
        at org.apache.maven.wagon.providers.http.httpclient.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
        at org.apache.maven.wagon.providers.http.httpclient.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
        at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.execute(AbstractHttpClientWagon.java:848)
        at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:1000)
        ... 45 more

There could be two reason:

First reason:

  • If you are working in home where don’t have firewall: First see which setting.xml file window is using and to see this execute below command:

Caused org apache maven wagon TransferFailedException

Caused org apache maven wagon TransferFailedException

  • As you see above reading global setting from C:\JavaHonk\Maven\apache-maven-3.2.5\conf\settings.xml and user setting from: C:\Users\JavaHonk\.m2\settings.xml. First open global setting.xml file and check if any proxy is enable in my with some dummy name through which maven was trying to connect and failing as below:

Caused org apache maven wagon TransferFailedException

  • I comment them out because its home network and we don’t use proxy as below:

Caused org apache maven wagon TransferFailedException

  • It started working.

Second reason: 

  • Almost all companies use proxy server to filter inbound and outbound traffic. You are getting exception because your proxy settings are not correct. Find proxy setting of your company using this tutorial
  • Now go to setting.xml file and add you proxy setting:

Caused org apache maven wagon TransferFailedException

  • Now delete your local repository. It should work please follow this tutorial if above solution doesn’t work.

Leave a Reply

Your email address will not be published. Required fields are marked *