Maven dependencies are not getting downloaded, proxy issues

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

Best Answer

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.

Related Topic