Section 1.3. Using Maven Behind a Proxy


1.3. Using Maven Behind a Proxy

Maven relies on an Internet connection, and it downloads all dependencies and plug-ins over HTTP. If you are working in a corporate environment, you may need to configure Maven to work with a proxy server.

1.3.1. How do I do that?

You will need to set some properties in your project's project.properties file. The project.properties file allows you to customize the behavior of Maven by setting named properties. To configure a proxy server, place the following project.properties file in the same directory as your project's project.xml file:

maven.proxy.host = proxy.company.com maven.proxy.port = 80

These properties configure Maven to connect to port 80 on the proxy.company.com machine. If you are using a proxy server that requires authentication, you will need to specify two additional properties:

maven.proxy.username = tobrien maven.proxy.password = myp@ssw0rd

And, if you need to connect to a proxy server which requires NTLM authentication, set the following properties:

maven.proxy.ntlm.username = tobrien maven.proxy.ntlm.password = myp@ssw0rd


Tip: In Section 2.1, you will learn that such user-specific properties should be defined in ~/build.properties or %USERPROFILE%\build.properties files. For now, define these properties in project.properties if you need to complete this lab from behind a firewall.


Maven. A Developer's Notebook
Maven: A Developers Notebook (Developers Notebooks)
ISBN: 0596007507
EAN: 2147483647
Year: 2003
Pages: 125

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net