Solved: Enable proxy setting in Maven

I was trying to run mvn commands for PetClinic Spring Application available at https://github.com/spring-projects/spring-petclinic

The problem was Firewall setting and hence my mvn command was not working. It failed to download. In this case where you from behind a proxy, no dependencies will be downloaded. 


Solution:



Go to apache-maven-3.3.9\conf

Right click on settings.xml file
Locate <proxies> block in the settings.xml
enable proxy setting in Maven to Download Jar files

Uncomment the <Proxy> Block and give value based on your Proxy Settings. Below is just a Sample.


   <proxy>

      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>discovertechno</username>
      <password>discovertechno</password>
      <host>dtproxy.discovertechno.com</host>
      <port>8080</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>

Done!

Labels: ,