Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven dependencies are not getting downloaded, proxy issues?

Tags:

maven

maven-3

Current WinHTTP proxy settings: Direct access (no proxy server) in windows machine. And in settings.xml as . But, jars are not getting downloaded and getting below error.

[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor fo

r org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.24.215] failed: Connection timed out: con nect -> [Help 1]

like image 348
Pand005 Avatar asked Jul 12 '16 12:07

Pand005


People also ask

Why are Maven dependencies not being downloaded?

If you run Maven and it fails to download your required dependencies it's likely to be caused by your local firewall & HTTP proxy configurations. See the Maven documentation for details of how to configure the HTTP proxy.

How do I force Maven to download dependencies?

Force maven to fetch dependencies from the remote repository while building the project. We can use -U/–update-snapshots flag when building a maven project to force maven to download dependencies from the remote repository.


1 Answers

As per maven documentation we have to add some settings.xml with setting in it mentioned here Guide to proxies .

<settings>
   <proxies>
      <proxy>
        <id>example-proxy</id>
        <active>true</active>
        <protocol>http</protocol>
        <host>proxy.example.com</host>
        <port>8080</port>
        <username>proxyuser</username>
        <password>somepassword</password>
        <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
      </proxy>
   </proxies>
   .
   .
</settings>

Another way to do download dependencies quickly is as follows

mvn clean install -DproxySet=true -DproxyHost=myproxy.com -DproxyPort=YourPort 

the second one works fine for me. Hope atleast one of above solution will work for you hoping your network doesn't have any blocked servers from maven repo.

like image 147
Ajhar Shaikh Avatar answered Oct 01 '22 13:10

Ajhar Shaikh