Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Maven3 How to enable proxy settings in Maven?

Related Tutorials


 
 

Share on Google+Share on Google+

How to enable proxy settings in Maven?

Advertisement
Learn how you can enable the proxy settings in Maven's settings.xml file?

Maven 3 Tutorial: How to enable proxy settings in Maven?

In this tutorial I will teach you how to enable proxy settings in maven? If your computer is behind firewall and you are accessing Internet through proxy server then the Maven build tools is not able to access the remote repository. To enable the proxy settings you have to make changes in the settings.xml file of Maven.

After making the changes in the settings.xml the Maven build tool will be able to make contact to the proxy server and then access the remote repository. This way you will be able to use the Maven build tool if you are behind firewall.

In Maven there is a file called settings.xml in the conf directory of your Maven installation. E.g. {MAVEN_HOME}/conf/settings.xml. So, first of go to the directory where Maven is installed and then go to the conf directory and you should be able to find the settings.xml file there.

Here are the steps to enable the proxy settings in Maven

Step 1: Open the file settings.xml and find the code given below:

<!-- 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.
|-->
<proxies>
<!-- proxy
| Specification for one proxy, to be used in connecting to the network.
|
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
-->
</proxies>

You will to uncomment the proxy tag and add the host name, user name and password of your proxy server.

Step 2: Uncomment the <proxy> tag and make the necessary changes in the host, username, password and port settings. Here is the example of the settings:

<proxies>
<!-- proxy
| Specification for one proxy, to be used in connecting to the network.
-->
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username></username>
<password></password>
<host>192.168.10.80</host>
<port>9090</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>

</proxies>

You should enter connect IP address, Username, Password and port number of your proxy sever. After making the above changes you should be able to use Maven through proxy server.

Here in this tutorial you have learned how to make changes in the settings.xml file of Maven to enable the remote repository access.

Read more Maven 3 tutorials.

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 27, 2013

Related Tutorials

Discuss: How to enable proxy settings in Maven?  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com