Apache Maven 2 Effective Implementation

Apache Maven 2 Effective Implementation
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Follow a sample application which will help you to get started quickly with Apache Maven
  • Learn how to use Apache Archiva - an extensible repository manager - with Maven to take care of your build artifact repository
  • Leverage the power of Continuum - Apache's continuous integration and build server - to improve the quality and maintain the consistency of your build
  • Guidance on how to use Maven in a team environment to maximise its potential

Book Details

Language : English
Paperback : 456 pages [ 235mm x 191mm ]
Release Date : September 2009
ISBN : 1847194540
ISBN 13 : 9781847194541
Author(s) : Brett Porter, Maria Odea Ching
Topics and Technologies : All Books, Application Development, Java, Open Source


Table of Contents

Chapter 1: Maven in a Nutshell
Chapter 2: Staying in Control with Archiva
Chapter 3: Building an Application Using Maven
Chapter 4: Application Testing with Maven
Chapter 5: Reporting and Checks
Chapter 6: Useful Maven Plugins
Chapter 7: Maven Best Practices
Chapter 8: Continuum: Ensuring the Health of your Source Code
Chapter 9: Continuum in Depth
Chapter 10: Archiva in a Team
Chapter 11: Archetypes
Chapter 12: Maven, Archiva, and Continuum in the Enterprise
Appendix A: Troubleshooting Maven
Appendix B: Recent Maven Features
Appendix C: Migrating Archiva and Continuum Data
  • Chapter 1: Maven in a Nutshell
    • A whirlwind tour
      • Installing Maven
      • Creating a new project from an archetype
      • Building the project
      • Reusing builds
      • Adding dependencies
      • Adding functionality through plugins
      • Adding resources
      • Running tests
      • Getting help
      • Enhancing the development process
      • Viewing detailed project information
      • Multiple module builds
      • What if I need to convert an existing project?
    • Summary
  • Chapter 2: Staying in Control with Archiva
    • Importance of a repository manager
    • Installing Archiva
    • Separating your repositories
    • Hooking up Maven with Archiva
      • Setting up a proxy
      • Configuring your settings.xml
      • Building your project
    • Searching for artifacts in Archiva
    • Deploying from Maven
      • Creating a new user
      • Configuring and deploying from Maven
    • Deploying via web form
    • Summary
  • Chapter 3: Building an Application Using Maven
    • Introducing the sample project
    • Setting up a multi-module build
      • Creating the parent POM
      • Creating the modules
      • Dependency management
      • Fleshing out the example application
    • Creating an organization POM
    • Configuring basic reports
    • Preparing for non-code modules
      • Creating a modules tree
    • Adding a documentation module
      • Building the site automatically
      • Assembling the site for distribution
      • Adding site resources
      • Adding a skin
    • Distributing the application
      • Generating the runtime environment with the App Assembler plugin
      • Generating the assembly archive
        • Adding the documentation to the distribution archive
    • Summary
  • Chapter 4: Application Testing with Maven
    • Types of testing in Maven
      • Unit testing (or code testing)
      • Integration testing (or module testing)
      • Functional and other types of testing
    • Working with tests
      • Surefire plugin configuration
        • Controlling the execution of tests
        • Inclusion and exclusion of tests
        • Running specific tests from the command line
        • Skipping tests temporarily
      • Producing a report for the test results
      • Reviewing test coverage
        • Coverage and multimodule projects
    • Integration, functional, and other testing
      • Running integration tests using naming patterns
        • Operating the Selenium server
        • Deploying the application to a container
        • Simplifying test grouping with TestNG
      • Using a separate integration test module
      • Altering integration tests with profiles
        • Using TestNG parameters
        • Measuring coverage for integration tests
    • Summary
  • Chapter 5: Reporting and Checks
    • Review: Example application
    • Constructing the developer's site
    • Maven reports
      • Adding reports to the project
      • Configuring plugins for both reporting and the build
      • Configuring reports in the site life cycle
    • Setting up quality checks
      • Setting a minimum coverage requirement
      • Best practices for configuring coverage checks
    • Reporting and quality tools
      • Dependencies
      • Javadoc
      • Checkstyle
      • PMD
      • FindBugs
      • Clirr
      • Other tools
    • Reporting best practices
      • Choosing reports
      • Site deployment
      • Introducing and selecting failure thresholds
    • Tying it all together
      • Dashboard plugin
      • Sonar
    • Summary
  • Chapter 6: Useful Maven Plugins
    • The Remote Resources plugin
      • Creating a Remote Resource bundle
      • Processing Remote Resources in a project
    • The Build Number plugin
    • The Shade plugin
      • Building a standalone artifact
      • Shading dependencies
    • The Build Helper plugin
      • Adding source directories
      • Attaching arbitrary artifacts
      • Other goals
    • The AntRun plugin and scripting languages
      • Running simple tasks
      • Interacting with the Maven project
      • Converting Ant or Maven 1 builds
      • Maven plugins written in Ant
      • Other scripting languages
    • The Exec plugin
      • Adding the Exec plugin to the Build life cycle
      • Running the Exec plugin standalone
    • Summary
  • Chapter 7: Maven Best Practices
    • Preparing the development environment
      • Maven installation and user settings
        • Encrypting server passwords
      • Project settings
      • Configuring repositories
    • Keeping it simple
      • Using conventions
      • Using inheritance
      • Decomposing the build into modules
        • Aligning the source structure
        • Selecting group and artifact identifiers
        • Building modules together
        • Each module should be independently useful
        • Watching the dependencies
        • Separating API from implementation
      • Trimming dependencies
      • Dependency version management
      • Profiles and pipelining
      • Scripting and writing plugins
      • Creating and using archetypes
    • Build portability
      • Setting expectations
      • Hard coding
      • Portable profiles
      • Portable artifacts
      • Resource filtering
      • Shared resources
    • Build reproducibility
    • Summary
  • Chapter 8: Continuum: Ensuring the Health of your Source Code
    • Knowing when your build breaks
    • Setting up Continuum
      • Setting up a source repository
      • Installing prerequisites
      • Installing and configuring Continuum
    • Using Continuum
      • At a glance
      • The build queues
      • The build definition
        • Project group build definition
        • Project build definition
      • The notifiers
        • Different types of notifiers
        • Configuring notifiers in Maven
      • The Build results
        • Dependency changes
      • Installations and build environments
        • Installations
        • Build environments
    • Summary
  • Chapter 9: Continuum in Depth
    • Releasing projects
      • Release early, release often
      • Maven release process
        • Release profile
      • Releasing projects using Continuum
        • Preparing a release
        • Finalizing a release
        • Viewing release history
        • Other types of releases
        • Troubleshooting releases in Continuum
    • Build pipelining and multiple build definitions
    • Parallel builds
      • How it works
      • Configuring parallel builds
    • Distributed builds
      • Master and slave
      • Configuring distributed builds
      • Doing project releases on a build agent
    • Maintenance
      • Configuring multiple local repositories
      • Cleaning up local repositories
      • Cleaning up directories
    • Summary
  • Chapter 10: Archiva in a Team
    • Roles and permissions
    • Introducing repository groups
      • Configuring and using repository groups
    • RSS feeds—discovering new artifacts in your repository
      • Repository level feeds
      • Artifact level feeds
    • Deleting artifacts in your repository
    • The Archiva reports
      • Repository statistics
      • Repository health
    • The Archiva consumers
      • What is a consumer?
      • Archiva's maintenance-savvy consumers
        • Purging outdated snapshots
        • Correcting Maven metadata
        • Creating missing checksums
        • Database cleanup consumers
    • Summary
  • Chapter 11: Archetypes
    • What are Maven archetypes?
      • Benefits of Maven archetypes
    • Generating projects
      • From archetype:create to archetype:generate
      • Using archetypes within multi-module projects
    • Common archetypes
      • Maven site archetype
      • Maven Mojo (plugin) archetype
      • Maven simple J2EE archetype
      • The AppFuse Spring archetype
      • Other examples
  • Writing a new archetype
    • Creating an archetype from a skeleton
    • Using the custom archetype
  • Managing catalogs
  • Summary
  • Chapter 12: Maven, Archiva, and Continuum in the Enterprise
    • Configuring security
      • A brief look at Redback
      • Setting up security for multiple teams in Continuum
      • Setting up security for multiple teams in Archiva
      • Additional Redback configuration
      • Using LDAP
    • Interfacing with other tools in the enterprise
      • Continuum web services
        • Building the Continuum plugin
        • Using Continuum's web services
      • Archiva web services
        • Building the Archiva plugin
        • Using Archiva's web services
    • Summary
  • Appendix B: Recent Maven Features
    • Server password encryption
    • Reactor project selection
      • Resuming a failed build
      • Building a subset of modules
      • The Reactor plugin
        • Building modules with local changes
    • Reconfiguring default life cycle goals
    • Parallel artifact resolution

Brett Porter

Brett Porter is a software developer from Sydney, Australia with a passion for development tooling, and automation. Seeking a more standardized and reproducible solution to organize, build, and deploy a number of software projects across teams, he discovered an early beta of Maven 1.0 in 2003, and has been heavily involved in the development of the project since. He is a member of the Apache Maven Project Management Committee, and has conducted presentations and training on Maven and related tooling at several conferences and events. He founded the Archiva project in 2005. Brett is also a member of the Apache Software Foundation.

Brett is currently VP, Product Development at G2iX, in charge of the Maestro division. He and his team seek to make developers more efficient by offering support and services for development and automation tools including Apache Maven, Apache Continuum, Apache Archiva, and Selenium.

Brett was co-author of the book Better Builds with Maven, the first book to be written about the Maven 2.0 release in 2005, and has been involved in reviewing Maven: A Developer's Notebook and Java Power Tools.

Maria Odea Ching

Maria Ching grew up in a small town called Daet, then moved to Manila when she went to college. She took up Computer Studies at De La Salle University and graduated in 2005. She started using open source tools from her first job after graduating and from then on, got interested in everything open source. When she came to work for Exist, she got assigned in a project doing a lot of development work in open source projects, specifically Maven, Continuum, and Archiva. Back then, Continuum and Archiva (formerly named Maven Repository Manager) were still sub-projects of Maven. Eventually, she became a committer, then a PMC member of Maven. In 2008, Continuum and Archiva became top-level projects at the ASF and Deng was elected as PMC Chair of Archiva. She is still currently serving as PMC Chair of the project and as PMC members of Continuum and Maven.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 5 submitted: last submission 29 Aug 2013

Errata type:CODE | Page number:61

should be:


Errata type:LANGUAGE | Page number:247 |

This might be the case software licenses, but in general is impractical.
should be
This might be the case of software licenses, but in general is impractical.


Errata type:OTHERS | Page number:405 |

[...], three goals are particularly geared towards troubleshooting.
should be [...]
, two goals are particularly geared towards troubleshooting.


Errata type:CODE | Page number:410 |

should be


Errata type:LANGUAGE | Page number:91 |

Creating a skin module is just a standard JAR with some specific resources, so the default archetype can be used as before, from the top-level centerpoint directory.
should be
A skin module is just a standard JAR with some specific resources, so to create it, the default archetype can be used as before, from the top-level centerpoint directory.


Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Apache Maven 2 Effective Implementation +    C Programming for Arduino =
50% Off
the second eBook
Price for both: €29.90

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Install Apache Maven and follow the sample application to build up your project as quickly as possible
  • Test your applications to ensure maximum stability using Maven's inbuilt tools
  • Use Maven's report and checking tools to ensure the health of your projects
  • Explore Apache Continuum which will help you to ensure the health of your source code
  • Improve your team builds with the powerful combination of Maven, Archiva and Continuum
  • Install and run the repository manager Apache Archiva

In Detail

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.

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.

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.

Create a secure, efficient, application using Apache Maven, Continuum and Archiva with this step-by-step guide for Java developers


All material in the book will be worked through by example, building up a sample application. It is intended to be read through in sequence, though once complete, should serve as a suitable reference for certain cases that can be referred to directly.

Who this book is for

This book is for Java developers who want to get started with Apache Maven. If you are tasked with build automation in your company, this book will help you to quickly and easily get started with Maven in order to improve the efficiency of your builds.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software