If you want to use maven2(mvn) behind a proxy then you have to do the following.
1. Go to settings.xml file which is located in /etc/maven2
sudo gedit /etc/maven2/settings.xml
2. Edit the file according to your proxy settings appropriate values.
Uncomment the proxies tag under settings and put the values for each tag
<settings> . . <proxies> <proxy> <active>true</active> <protocol>http</protocol> <host>proxy.somewhere.com</host> <port>8080</port> <username>proxyuser</username> <password>somepassword</password> <nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts> </proxy> </proxies> . . </settings>
3. Save and you are Done!