0% found this document useful (0 votes)
58 views11 pages

Overview Maven Plugins

The document discusses several Maven plugins that are commonly used in the Maven build lifecycle. It describes the Maven Clean plugin which removes generated files, the Compiler plugin which compiles Java code, and the Resources plugin which copies resources. It also summarizes the Surefire plugin for running tests, the Jar plugin for packaging artifacts, and the Deploy and Site plugins for deployment and site generation.
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)
58 views11 pages

Overview Maven Plugins

The document discusses several Maven plugins that are commonly used in the Maven build lifecycle. It describes the Maven Clean plugin which removes generated files, the Compiler plugin which compiles Java code, and the Resources plugin which copies resources. It also summarizes the Surefire plugin for running tests, the Jar plugin for packaging artifacts, and the Deploy and Site plugins for deployment and site generation.
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/ 11

Apache Maven

Beginner to Guru

Maven Lifecycle Plugins


Maven Clean Plugin
• Build Lifecycle - CLEAN
• Has only one goal - ‘clean’
• Purpose is to remove files generated during build process.

• By default removes /target directory project root and submodule root folders
Maven Compiler Plugin
• Build Lifecycle - DEFAULT
• Has two goals - compiler:compile, compiler:testCompile
• By Default uses the compiler ‘javax.tools.JavaCompiler

• Can be configured to use javac if needed


• Default source and target language levels are Java 1.6
• Apache team encourages these values to be set
Maven Resources Plugin
• Build Lifecycle - DEFAULT
• Has 3 goals - resources:resources, resources:testResources, resources:copy-resources
• Purpose is to copy project resources to output directory (target dir)

• Can be configured for encoding, source and target directories


• Rather versatile configuration options for copying files during build processing
Maven Surefire Plugin
• Build Lifecycle - DEFAULT
• Has one goal: surefire:test
• The Surefire plugin is used to execute unit test of the project.

• By default supports JUnit 3, JUnit 4, JUnit 5, and TestNG


• Cucumber runs under JUnit, Spock compiles to JUnit byte code.
• By default includes classes named:
• **/Test*.java; **/*Test.java; **/*Tests.java; **/*TestCase.java
Maven jar plugin
• Build Lifecycle - DEFAULT
• Has two goals: jar:jar, jar:test-jar
• Purpose is to build jars from complied artifacts and project resources

• Can be configured for custom manifests, and to make executable jars.


Maven Deploy Plugin
• Build Lifecycle - DEFAULT
• Has two goals - deploy:deploy, deploy:deploy-file
• Purpose is to deploy project artifacts to remote Maven repositories

• Often done in CI
• Configuration is typically part of the Maven POM
Maven Site Plugin
• Build Lifecycle - SITE
• Has 7 goals:
• site:site - Generate site for project

• site:deploy - Deploy site via Wagon


• site:run - Run Site locally using Jetty as web server
• site:stage - generate site to a local staging directory
• site:stage-deploy - Deploy site to remote staging location
Maven Site Plugin
• Site Plugin Goals (continued):
• site:attach-descriptor - adds site.xml (site map file used by search engines) to files for
deployment
• site:jar - bundles site into a jar for deployment to a repository
• site:effective-site - generates the site.xml file
Examples
•Examples or detailed reviews of each plugin coming up!
Apache Maven
Beginner to Guru

You might also like