Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
53 views10 pages

Maven Build Life Cycles

The document discusses Maven build lifecycles which define a sequence of build phases called by plugins. It describes the three main lifecycles - clean, default, and site. The clean lifecycle removes build artifacts. The default lifecycle builds and deploys a project through phases like compile, test, package. The site lifecycle creates project documentation websites.

Uploaded by

Laura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views10 pages

Maven Build Life Cycles

The document discusses Maven build lifecycles which define a sequence of build phases called by plugins. It describes the three main lifecycles - clean, default, and site. The clean lifecycle removes build artifacts. The default lifecycle builds and deploys a project through phases like compile, test, package. The site lifecycle creates project documentation websites.

Uploaded by

Laura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Apache Maven

Beginner to Guru

Maven Build Lifecycles


Maven Build Lifecycles
• Maven is based on the concept of build lifecycles
• A lifecycle is a pre-defined group of build steps called phases
• Each phase can be bound to one or more plugin goals

• Keep in mind all work done in Maven is done by plugins!


• Lifecycles and phases provide the framework to call plugin goals in a sequence
Maven Build Lifecycles
• Maven has three pre-defined lifecycles: clean, default, site.
• Clean
• Does a clean of the project, removes all build artifacts from working directory

• Defined with plugin bindings


• Default
• Does the build and deployment of your project
• Defined without plugin bindings, bindings are defined for each packaging
Site Build Lifecycle
• Site
• Creates the a website for your project
• Defined with plugin bindings

• Least used in the enterprise


• See any of the Maven websites for examples
• All are built using the Maven site lifecycle.
Clean Lifecycle

Clean Lifecycle

Phase: pre-clean

Maven Clean Plugin


Phase: clean Plugin Binding
Goal: clean

Phase:post-clean
Default Lifecycle - High-level
• Validate - Verify project is correct
• Compile - Compile Source Code
• Test - Test Compiled Source Code

• Package - Package compiled files to packaging type


• Verify - Run Integration Tests
• Install - Install to local Maven Repository
• Deploy - Deploy to shared Maven Repository
Default Lifecycle All Phases
• Validate • Generate Test Sources • Package
• Initialize • Process Test Sources • Pre-Integration Test
• Generate Sources • Generate Test Resources • Integration Test
• Process Sources • Process Test Resources • Post Integration Test
• Generate Resources • Test Compile • Verify
• Process Resources • Process Test Classes • Install
• Compile • Test • Deploy
• Process Classes • Prepare Package
Default Lifecycle - JAR Packaging
• Phase: process-resources - Plugin: maven-resources-plugin : resources
• Phase: compile - Plugin: maven-compiler-plugin : compile
• Phase: process-test-resources - Plugin: maven-resources-plugin : testResources
• Phase: test-compile - Plugin: maven-compiler-plugin : testCompile
• Phase: test - Plugin: maven-surefire-plugin : test
• Phase: package - Plugin: maven-jar-plugin : jar
• Phase: install - Plugin: maven-install-plugin : install
• Phase: deploy - Plugin: maven-deploy-plugin : deploy
Site Build Lifecycle
• Site Lifecycle Phases
• Phase: Pre-site - Plugin: none
• Phase: Site - Plugin: maven-site-plugin : site
• Phase: Post-site - Plugin: none
• Phase: Site-Deploy - Plugin: maven-site-plugin : deploy
Apache Maven
Beginner to Guru

You might also like