Skip to Main Content
Maven: The Definitive Guide
book

Maven: The Definitive Guide

by Sonatype Company
September 2008
Intermediate to advanced content levelIntermediate to advanced
470 pages
14h 22m
English
O'Reilly Media, Inc.
Content preview from Maven: The Definitive Guide

Assembly Basics

Before we go any further, it’s best to take a minute and talk about the two main goals in the Assembly plugin: assembly:assembly and the single mojo. We list these two goals in different ways to reflect the difference in how they’re used. The assembly:assembly goal is designed to be invoked directly from the command line and should never be bound to a build lifecycle phase. In contrast, the single mojo is designed to be a part of your everyday build and should be bound to a phase in your project’s build lifecycle.

The main reason for this difference is that the assembly:assembly goal is what Maven terms an aggregator mojo—that is, a mojo that is designed to run at most once in a build, regardless of how many projects are being built. It draws its configuration from the root project, usually the top-level POM or the command line. When bound to a lifecycle, an aggregator mojo can have some nasty side effects. It can force the execution of the package lifecycle phase to execute ahead of time, and it can result in builds that end up executing the package phase twice.

Because the assembly:assembly goal is an aggregator mojo, it raises some issues in multimodule Maven builds, and it should be called only as a standalone mojo from the command line. Never bind an assembly:assembly execution to a lifecycle phase. assembly:assembly was the original goal in the Assembly plugin and was never designed to be part of the standard build process for a project. As it became clear that ...

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.
Start your free trial

You might also like

Apache Maven Cookbook

Apache Maven Cookbook

Raghuram Bharathan
Mastering Apache Maven 3

Mastering Apache Maven 3

Prabath Siriwardena
Learning Apache Maven

Learning Apache Maven

Kevin Bowersox

Publisher Resources

ISBN: 9780596517335Supplemental ContentErrata Page