How to use Maven through a proxy?

Sometimes inside corporate networks you may not have direct access to the Internet, but only through a proxy. In this article, we will look at how to use maven through a proxy.

1. Register proxy in settings

You need to ensure the proxies section in either the global settings (maven dir/conf/settings.xml), or user settings (${user.home}/.m2/settings.xml) is configured correctly. It is better to do this in your user settings to avoid storing the password in plain text in a public location.

2. Set MAVEN_OPTS environment variable

Linux (bash):

Windows:

 

 

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.