MAVEN
MAVEN
MAVEN
What is Maven?
Archetypes
Dependencies
Lifecycles
Execution
Plugins
Build tool
Filtering
Maven in Eclipse
2
What is Maven?
When you use Maven, you describe your project using a well-defined project object
model, Maven can then apply cross-cutting logic from a set of shared (or custom)
plugins.
3
Convention over Configuration
4
What does Maven do?
5
Installation
To use it independently:
6
Creating a Project
An archetype is defined as an original pattern or model from which all other things of
the same kind are made
7
Archetypes (predefined)
8
Standard Directory Layout
9
POM.XML
10
POM.XML
11
Dependencies
https://mvnrepository.com/
12
Build Lifecycles
There are three built-in build lifecycles: default, clean and site.
13
Default lifecycle common phases
● validate - validate the project is correct and all necessary information is available
● compile - compile the source code of the project
● test - test the compiled source code using a suitable unit testing framework. These
tests should not require the code be packaged or deployed
● package - take the compiled code and package it in its distributable format, such as a
JAR.
● verify - run any checks on results of integration tests to ensure quality criteria are met
● install - install the package into the local repository, for use as a dependency in other
projects locally
● deploy - done in the build environment, copies the final package to the remote
repository for sharing with other developers and projects
14
How do I compile my application sources?
15
How do I compile
my test sources
and run my unit
tests?
16
How do I create a JAR…
17
Plugins
Maven is - at its heart - a plugin execution
framework; all work is done by plugins.
19
Maven & Eclipse
Let’s try it out!
20
References
21
I keep six honest serving-men (They taught me all I knew);
Their names are What and Why and When And How and Where and Who.
Rudyard Kipling
22