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.
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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access