Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Maven Essentials

You're reading from   Maven Essentials Get started with the essentials of Apache Maven and get your build automation system up and running quickly

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher
ISBN-13 9781783986767
Length 184 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Russell E Gold Russell E Gold
Author Profile Icon Russell E Gold
Russell E Gold
 Siriwardena Siriwardena
Author Profile Icon Siriwardena
Siriwardena
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Maven Essentials
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface
1. Apache Maven Quick Start FREE CHAPTER 2. Understanding the Project Object Model (POM) 3. Maven Archetypes 4. Maven Plugins 5. Build Lifecycles 6. Maven Assemblies 7. Best Practices Index

Lifecycle extensions


The lifecycle extensions in Maven allow you to customize the standard build behavior. Let's take a look at the org.apache.maven.AbstractMavenLifecycleParticipant class. A custom lifecycle extension should extend from the AbstractMavenLifecycleParticipant class, which provides the following three methods that you can override:

  • afterProjectsRead(MavenSession session): This method is invoked after all the Maven project instances have been created. There will be one project instance for each POM file. In a large-scale build system, you have one parent POM and it points to multiple child POM files.

  • afterSessionEnd(MavenSession session): This method is invoked after all Maven projects are built.

  • afterSessionStart(MavenSession session): This method is invoked after the MavenSession instance is created.

Let's try out the following example:

package com.packt.lifecycle.ext;

import org.apache.maven.AbstractMavenLifecycleParticipant;
import org.apache.maven.MavenExecutionException...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images