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>YOUR_USERNAME</username>
<password>YOUR_PASSWORD</password>
<host>PROXY_URL</host>
<port>8080</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>

Done!

Leave a comment

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