Sunday, February 9, 2014

Apache Maven - How To Enable Proxy Setting

There might be a chance in your company is that a firewall is set up a and an HTTP proxy server to stop user to connect to internet directly. If you are behind a proxy, Maven will fail to download any dependencies.
To make it work, you have to declare the proxy server setting in Maven configuration file settings.xmlIt can be found in conf directory, i.e.,  {M2_HOME}/conf/settings.xml.
<!-- proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
Un-comment the proxy options and fill in your proxy server detail and save it.

Done, your Apache Maven should be able to connect to the Internet via your proxy server now. Restart is NOT required as Maven is just a command, when you call it, it will read this file again.

No comments:

Post a Comment