How do i set Proxy for Maven (in Eclipse)?

Problem Statement:
(1) I am behind a firewall, therefore Maven is unable to connect to repositories to download jars etc.

Solution:
In MAVEN_HOME\apache-maven-3.0.3\conf dir you have settings.xml. Open it and update the following:

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

Also check the following dir on windows:
C:\Documents and Settings\useName\.m2
If this has settings.xml – update that too.

Remember that username may require to be prefixed with domain name eg: mycorp/myuser

Problem Statement:
(2) I am behind a firewall, using Eclipse IDE and have a Maven Plugin. But it is unable to connect to repositories.

Solution:
Menu> Windows > Preferences > General > Network Connections.

Update the Proxy entries there.
In case this does not work, try doing the Step 1 solution as well.

NOTE:
1. Many Corporate Proxies will block you (temporarily?) on repeated authentication failures. Therefore be aware of this possibility.
2. Try to authenticate yourself against your network say by logging off and logging into your system to ensure that your login credentials are still valid.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: