Book Image

Apache Maven 2 Effective Implementation

By : Brett Porter, Maria Odea Ching
Book Image

Apache Maven 2 Effective Implementation

By: Brett Porter, Maria Odea Ching

Overview of this book

<p>By building up a sample application, this book guides developers painlessly through building a project with Maven. This book shows you how to combine Maven with Continuum and Archiva, which will allow you to build an efficient, secure application and make developing in a team easy.<br /><br />You may already be aware of the pitfalls of 'integration hell' caused by changed code being submitted to repositories by a number of developers. When you implement Continuum in your build, you can easily perform continuous integration, avoiding timely rework and reducing cost and valuable time. You will be able to use Maven more efficiently in a team after you learn how to set up Archiva, Apache's repository manager.<br /><br />It's easy to quickly get to work with Maven and get the most out of its related tools when you follow the sequential coverage of the sample application in this book. A focus on team environments ensures that you will avoid the pitfalls that are all too common when working in a team. Soon, by learning the best practices of working with Maven, you will have built an effective, secure Java application.</p>
Table of Contents (21 chapters)
Apache Maven 2 Effective Implementation
Credits
About the Authors
About the Reviewers
Preface
Free Chapter
1
Maven in a Nutshell
Index

Parallel artifact resolution


By default, Maven 2.1.0 and above will download up to five artifacts at a time. There is no need to add any additional configuration to enable this new feature.

At present, it will only download artifacts from different groups simultaneously. This limit was made to prevent potential sequencing issues. This may be enhanced in a later version of Maven, however at present it limits the possible performance gains by raising the number of parallel downloads. The main gains will be when there are a number of large artifacts to download, or when the local repository is regularly cleaned.

Note

Even with a repository manager very close by caching artifacts, parallel downloads can improve performance in retrieving the artifacts with a clean repository.

It is possible to change the number of active download threads, which is useful if you wish to try to add a minimal amount more performance, or if you need to limit the resources used by the Maven process.

To change the size of the thread pool, start Maven using -Dmaven.artifact.threads. For example, to only download single artifacts at a time:

$ mvn -Dmaven.artifact.threads=1 clean install

You may wish to set this option permanently, in which case you can use the MAVEN_OPTS environment variable. For example:

$ export MAVEN_OPTS=-Dmaven.artifact.threads=3

Such an option may be considered within your build server. In Continuum, this can be added to a build definition via an installation environment variable. See Installations in Chapter 8, Continuum: Ensuring the Health of your Source Code for an example of configuring MAVEN_OPTS in Continuum.