Roy Javelosa is a software engineer specializing in Java, mobile application development and other emerging technologies. He is currently working for one of Philippines largest telecommunications company. Jose Roy is a DZone MVB and is not an employee of DZone and has posted 3 posts at DZone. You can read more from them at their website. View Full User Profile

How to get Maven working through a proxy server

  • submit to reddit

Maven, is a Yiddish word meaning accumulator of knowledge. Maven is a tool that can now be used for building and managing any Java-based project, something that makes the day-to-day work of Java developers easier.

Maven’s Objectives

  • Making the build process easy
  • Providing a uniform build system
  • Providing quality project information
  • Providing guidelines for best practices development
  • Allowing transparent migration to new features
  • I personally think that mavens greatest contribution to the opensource community is the way it provides developers with  a uniform build system.  Further information about maven can be found at and tutorials on how to use maven is just a google away.  The only problem that you might encounter with maven is how to get it working through a proxy server.

    To save you time, below is the line of code you’ll append at the end of your maven command so that maven would work properly even if your using a proxy server.

    -DproxySet=true -DproxyHost=ur.proxy.server -DproxyPort=port

    where -DproxyHost value is “YOUR PROXY SERVER” and -DproxyPort is“YOUR PORT NUMBER”

    You can view your proxy settings through

    Internet Explorer >> tools >> internet options >> Connections >> LAN Settings

    Fire Fox >> tools >> options >> ADVANCED TAB >> settings

    If you find yourself using maven from time to time specially to gather dependencies I would suggest you manually edit your maven settings.  There is an existing official tutorial on how to do this at but to save you time, below is a portion of the tutorial which I copied from their site.

    You can configure a proxy to use for some or all of your HTTP requests in Maven 2.0. The username and password are only required if your proxy requires basic authentication (note that later releases may support storing your passwords in a secured keystore – in the mean time, please ensure your settings.xml file (usually ${user.home}/.m2/settings.xml) is secured with permissions appropriate for your operating system).

    The nonProxyHosts setting accepts wild cards, and each host not to proxy is separated by the | character. This matches the JDK configuration equivalent.


    Please note that currently NTLM proxies are not supported as they have not been tested. You may be able to use the relevant system properties on JDK 1.4+ to make this work.



    Published at DZone with permission of Jose Roy Javelosa, author and DZone MVB.

    (Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


    Lieven Doclo replied on Tue, 2011/08/16 - 1:41am

    On the NTLM proxies: if you're using an NTLM proxy with domain authentication, you'll have to use CNTLM to serve as a basic proxy to the NTLM proxy. It depends on the version of httpclient you're using, but for example Nexus uses a version which can't properly handle NTLM authentication. This'll probably be the same for Maven in general.

    Comment viewing options

    Select your preferred way to display the comments and click "Save settings" to activate your changes.