I had to perform a few steps in order to set up proxy for Maven:
1. Localize Apache Maven settings.xml file
You have two settings.xml files:- Global settings file localized under $M2_HOME/conf/settings.xml. $M2_HOME is Apache Maven installation directory.
- User settings file under ${user.home}/.m2/settings.xml. ${user.home} is user home directory and it depends on the operating system you are using:
- ~/.m2/settings.xml on Unix systems (Mac OS X, Linux etc.).
- C:\Users\your-username\.m2 on Windows.
- User settings overwrite global settings,
- settings.xml under ${user.home}/.m2/settings.xml may not exist. If it does not exist you need to create it (copy global settings to ${user.home}/.m2/settings.xml).
- If you don't know where your Maven installation on Unix systems is (because M2_HOME variable is not set), you could execute mvn -version. It will return information about your Maven installation. settings.xml is located under conf directory under Maven home.
2. Set up Apache Maven proxy in settings.xml
I modified user settings.xml:- Open ${user.home}/.m2/settings.xml
- Find proxies node inside this file.
- Set your proxy settings in proxy node:
When settings are changed, you shouldn't have any further problems with downloading dependencies from the Internet.<proxies> <proxy> <id>whatever-name-to-identifie-your-proxy</id> <active>true</active> <protocol>http</protocol> <host>proxy.your-company.com</host> <port>8080</port> <username>username</username> <password>password</password> <nonProxyHosts>*.exclude.me|and.me</nonProxyHosts> </proxy> </proxies>
0 comments :: How to set up proxy for Maven ?
Post a Comment