Working with Proxies and internal artifact repositories

Posted by Vishnu Vardhan Chikoti

Posted on 15-Jun-2019 16:14:13

If you working at a start-up or using a personal laptop/IaaS/PaaS account, you will have an advantage of admin privileges and no usage of a proxy or an artifact repository like Nexus. But if you are working for larger organisations, you will have trouble with admin privileges and a proxy that you need to setup. While browsers are automatically set to use the system proxy, unfortunately many tools (GUI or command line executables) do not pick them by default and will need you to explicitly set the proxy. In most of the cases it is a one-time setup that you need to do when you join the organisation or do a team movement. However, in the fast changing technology world and an ever increasing open source community, there are new tools/libraries/platforms/frameworks/services, etc that are coming up and you keep running into a need to download and try something new which may solve a problem for your team or simplify an existing solution.

In this post, I will cover the proxy and Nexus setup for few of the use cases.

Proxy on a Mac or Linux/Unix terminal (using bash shell)

export http_proxy=http://proxyhost:port

export https_proxy=http://proxyhost:port

– replace http with https if its a HTTPS based proxy.

– http_proxy is for HTTP connections and https is for HTTPS connections.

If your proxy requires a user name and password, provide those also.

export http_proxy=http://username:password@proxyhost:port

export https_proxy=http://username:password@proxyhost:port

Setup for Maven

You have 2 options for providing the proxy details and one way to set Nexus as a repository.

  1. Set proxy in the Maven settings.xml file ($HOME/.m2/settings.xml).








Set Nexus as your artifact repository in your settings.xml file to download the dependencies in your pom file.







And to set the repository in your .pom file, add the below to it.




  1. Setting proxy in command line

Proxy can be supplied for Maven or infact the java binary as well with the D options.

mvn -D java -D

mvn -Dhttp.proxyHost=[proxyhost] -Dhttp.proxyPort=[proxyport] -Dhttp.nonProxyHosts=[proxybypasshosts]

java D http.proxyHost=[proxyhost] D http.proxyPort=[proxyport] D http.nonProxyHosts=[proxybypasshosts]

  1. Setting proxy in Java code

You can use the proxy inside Java code by setting the System properties.

  System.setProperty("", "true");


  System.setProperty("http.proxyHost", host);

  System.setProperty("http.proxyPort", port);

Setting up pip to use Nexus

Luckily pip, atleast on bash terminals uses the http_proxy and https_proxy environment variables. Put the following in your pip.conf file to use Nexus PyPI repository instead of the external


index = http://nexushost:8081/repository/pypi-all/pypi

index-url = http://nexushost:8081/repository/pypi-all/simple

Setting up proxy for Docker on Mac

On Mac, Docker Desktop can be located on the top panel. The proxy can be setup under Preferences->Proxies.

Setting up Proxy in STS

The proxy in STS can be setup under Preferences->General->Network Connections.

About the author

Vishnu Vardhan Chikoti is a co-author for the book "Hands-on Site Reliability Engineering". He is a technology leader with diverse experience in the areas of Application and Database design and development, Micro-services & Micro-frontends, DevOps, Site Reliability Engineering and Machine Learning.

With an ability to conduct deep analysis, strong execution skills and an innovative mindset, he has successfully led R&D teams to build engineering solutions to improve reliability of applications. He also has deep expertise in building high volume transaction processing applications for middle & back office functions at Investment Banks using a variety of architectures.

He has been part of leadership teams in driving Site Reliability Engineering transformation and Agile transformation.

Would you like to get notifications about New Blogs?