Book Image

Mastering Apache Maven 3

Book Image

Mastering Apache Maven 3

Overview of this book

Table of Contents (16 chapters)
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Avoid keeping credentials in application POM files


During a Maven build, you need to connect to external repositories outside your firewall. In a tightened secured environment, any outbound connection has to go through an internal proxy server. The following configuration in MAVEN_HOME/conf/settings.xml shows how to connect to an external repository via a secured proxy server:

<proxy>
  <id>internal_proxy</id>
  <active>true</active>
  <protocol>http</protocol>
  <username>proxyuser</username>
  <password>proxypass</password>
  <host>proxy.host.net</host>
  <port>80</port>
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>

Also, the Maven repositories can be protected for legitimate access. If a given repository is protected with HTTP basic authentication, the corresponding credentials should be defined as shown in the following code, under the servers element of MAVEN_HOME...