8/20/2006

Tip: Installing Maven 2 Behind A Proxy

Filed under: — Aviran Mordo @ 4:30 pm

If you are a java programmer you probably know the Ant build tool. However creating an Ant build script can be very complicated, and hard to maintain. The apache group recently released a new build tool called Maven (which is now in version 2), and it makes the build scripts very easy to create.

Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information.

Indeed getting started with Maven is pretty strait forward, however if you are working in a corporate network and behind a firewall this simple step of configuring maven to use the corporate proxy will save you a lot of time and aggravation.

Edit your maven configuration file settings.xml under maven-2.0.x/conf

Now we need to configure a proxy. In the settings.xml file find the element and add the following child element under it:


<proxy>
   <id>myproxy</id>
   <active>true</active>
   <protocol>http</protocol>
   <host>proxy.yourcompanydomain.com</host>
   <port>80</port>
   <nonproxyhosts>localhost|158.187.*</nonproxyhosts>
</proxy>

Note the <nonProxyHosts> element. This element is needed to bypass proxy for local network access, such as for working with local corporate repository

 

One Response to “Tip: Installing Maven 2 Behind A Proxy”

  1. Raj Says:

    Hey one minute when u r configuring proxy settings in maven it looks one in /.m2/settings.xml not in maven-2.0.x/conf, because I was very upset when I not getting download my artifacts, but lastly it works when I did it /.m2/settings.xml,
    Is am right ?

Leave a Reply

You must have Javascript enabled in order to submit comments.

All fields are optional (except comment).
Some comments may be held for moderation (depends on spam filter) and not show up immediately.
Links will automatically get rel="nofollow" attribute to deter spammers.

Powered by WordPress