Introduction to maven, its configuration, lifecycle and relationship to JS world

Dmitry Bakaleinik
Dmitry BakaleinikSenior Web Developer at Barracuda Media Group em Barracuda Media Group
Maven
technical session
Dmitry
 Bakaleinik

January
 2015
Maven

expert; know-it-all
ComingfromtheHebrewwordHebrew ‫מבין‬(mevin),
mavencanhavetwodefinitions.
Incommoncontextsmeansexpert.
However,insarcasticsettings,itisusedas“know-it-all”.
– YiddishSlangDictionary
The maven project was originally started as an attempt to
simplify the build processes.
Maven addresses two aspects of building software:
First, it describes how software is built, and second, it describes its
dependencies.
pom.xml
compiled code
artifact jar/war/
othertests coverage
documentation
quality report
What maven can do?
Centralize project information such as build metadata, properties, version
control systems, developers in project object model file (pom.xml).
Manage our build process; does project build tasks such as compilation,
unit testing, integration testing, quality metrics, documentation generation
as it required for the successful delivery.
Manage project library and resources dependencies.
Manage project artifacts deployment to corporate/public repositories.
Maven plugins
Maven is actually a plugin execution framework where every task is
actually done by plugins.
A plugin provides a set of actions or commands (in maven terminology
called goals) that can be executed to perform a task.
There are plugins for building, testing, source control management,
running a web server, generating project files and much more.
Some basic plugins are included in every project by default, and they have
sensible default settings.
Maven plugins suite
Core
clean
compiler
deploy
failsafe
install
resources
site
surefire
verifier
Reporting
Changelog
Changes
Checkstyle
Clover
Javadocs
PMD
Surefire-reports
Local servers
Cargo
jaxme
jetty
tomcat
Tools
Ant
Antlr
Antrun
Archetype
Assembly
Help
Release
Packaging
jar war ear ejb
rar pom shade
IDE integration
eclipse
idea
Maven plugins suite
Core
clean
compiler
deploy
failsafe
install
resources
site
surefire
verifier
Reporting
Changelog
Changes
Checkstyle
Clover
Javadocs
PMD
Surefire-reports
Local servers
Cargo
jaxme
jetty
tomcat
Tools
Ant
Antlr
Antrun
Archetype
Assembly
Help
Release
Packaging
jar war ear ejb
rar pom shade
IDE integration
eclipse
idea
And
 much
 more…⋯
Maven plugin goals
Maven plugin goals
A plugin generally provides a set of goals and which can be executed using
following syntax:

mvn [plugin-name]:[goal-name]
Maven plugin goals
A plugin generally provides a set of goals and which can be executed using
following syntax:
mvn [plugin-name]:[goal-name]
For example, a Java project can be compiled with the maven-compiler-
plugin's compile-goal by running following command:

my-project-dir mvn compiler:compile
Maven plugin goals
A plugin generally provides a set of goals and which can be executed using
following syntax:
mvn [plugin-name]:[goal-name]
For example, a Java project can be compiled with the maven-compiler-
plugin's compile-goal by running following command:
my-project-dir
You can get information about plugin and its goals using maven help
plugin:

mvn help:describe -Dplugin=compiler
Maven plugin goals
A plugin generally provides a set of goals and which can be executed using
following syntax:
mvn [plugin-name]:[goal-name]
For example, a Java project can be compiled with the maven-compiler-
plugin's compile-goal by running following command:
my-project-dir
You can get information about plugin and its goals using maven help
plugin:

mvn help:describe -Dplugin=compiler
Project Object Model (POM)
Project Object Model (POM)
A Project Object Model or POM is the fundamental unit of work in Maven.
It’s an XML file that contains information about the project and configuration
details used by Maven to build the project.
The configuration that can be specified in the POM are the project dependencies,
the plugins or goals that can be executed, the build profiles, and so on.
When executing a task or goal, Maven looks for the POM in the current working
directory, but you can explicitly tell to maven path of POM file:

mvn -f path/to/pom.xml
Simplest pom.xml
Coordinates.What???
Every maven project is identified by its GAV coordinates.
groupId (G) - It’s an identifier for a collection of related modules.

This is usually a hierarchy that starts with the organization that produced the
modules, and then possibly moves into increasingly more specialized projects,
e.g. com.sap.ui5 or com.sap.fiori.
G
A
V
Coordinates.What???
artifact (A) - It’s a unique identifier or a simple name that is given to a
module within a group
There can be multiple modules in a group.

If a group has a module called webapp, its artifactId will be“webapp”.
G
A
V
Coordinates.What???
version (V) - It’s an identifier for the release or build number of project,

e.g. 1.0 or 1.0-SNAPSHOT
G
A
V
Coordinates.What???
version (V) - It’s an identifier for the release or build number of project,
e.g. 1.0 or 1.0-SNAPSHOT
Now what’s this SNAPSHOT?
G
A
V
Versioning strategy
There are two types of versions: release and snapshot.
Releases - a version that is assumed never to change.

Only to be used for a single state of the project when it is released and then updated to the
next snapshot
Snapshot - used by projects during development as it implies that development is still
occurring that project may change
G
A
V
Simplest pom.xml
Simplest pom.xml
mvn install
Simplest pom.xml
mvn install
{
compile code
run tests
package as jar
deploy to local repo
How all this can be done
from 6 lines of xml?
Super POM
Super POM
The modelVersion property defines the super POM 

file (org/apache/maven/model/pom-4.0.0.xml)
Super POM
The modelVersion property defines the super POM 

file (org/apache/maven/model/pom-4.0.0.xml)
Super POM
The modelVersion property defines the super POM 

file (org/apache/maven/model/pom-4.0.0.xml)
Standard
 

directory
 

layout
Super POM
The modelVersion property defines the super POM 

file (org/apache/maven/model/pom-4.0.0.xml)
properties

interpolation
Super POM
The modelVersion property defines the super POM 

file (org/apache/maven/model/pom-4.0.0.xml)
Super POM
The modelVersion property defines the super POM
file (org/apache/maven/model/pom-4.0.0.xml)
Work with the same analogy as objectsinheritance
Effec%ve'POM'
POM'
Parent'
POM'
Super'
POM'
Super POM
The modelVersion property defines the super POM
file (org/apache/maven/model/pom-4.0.0.xml)
Work with the same analogy as
To see the merged pom:

mvn help:effective-pom Effec%ve'POM'
POM'
Parent'
POM'
Super'
POM'
Property references
env.*

Environment variables exposed by OS or Shell

${env.JAVA_HOME}
project.*

POM elemens

${project.groupId} ${project.parent.groupId}
settings.*

Maven settings.xml properties

${settings.localRepository}
Custom properties

${foo}
Build Lifecycle
In maven, the build is run is a predefined ordered set of steps called the
build lifecycle.
The individual steps are called phases and the same phases are run for
every maven build using the default lifecycle, no matter what it produce.
The build task that will be performed during each phase are determined by
the configuration in the project file, and in particular in the selected
packaging.
Build lifecycle
Validate
•  Validate the project is correct
and all necessary information
is available
Compile
•  Compile the source code of
the project
Test
•  Test the compiled 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 distributable
format, such as a JAR
Integration-test
•  Process and deploy the
package if necessary into a
environment where
integration tests can run
Verify
•  Run any checks to verify the
package is valid and meets
the quality criteria
Install
•  Install the package into the
local repository, for use as a
dependency for other
projects locally
Deploy
•  Done in integration or release
environment, copies the final
package to the local
repository, then deploy the
installed package in a
specified environment.
Default 

Lifecycle
(collectionofbuildphases)
Build lifecycle
mvn install
Validate
•  Validate the project is correct
and all necessary information
is available
Compile
•  Compile the source code of
the project
Test
•  Test the compiled 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 distributable
format, such as a JAR
Integration-test
•  Process and deploy the
package if necessary into a
environment where
integration tests can run
Verify
•  Run any checks to verify the
package is valid and meets
the quality criteria
Install
•  Install the package into the
local repository, for use as a
dependency for other
projects locally
Deploy
•  Done in integration or release
environment, copies the final
package to the local
repository, then deploy the
installed package in a
specified environment.
X
Build lifecycle
Validate
•  Validate the project is correct
and all necessary information
is available
Compile
•  Compile the source code of
the project
Test
•  Test the compiled 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 distributable
format, such as a JAR
Integration-test
•  Process and deploy the
package if necessary into a
environment where
integration tests can run
Verify
•  Run any checks to verify the
package is valid and meets
the quality criteria
Install
•  Install the package into the
local repository, for use as a
dependency for other
projects locally
Deploy
•  Done in integration or release
environment, copies the final
package to the local
repository, then deploy the
installed package in a
specified environment.
X mvn clean install
+Pre-clean
Clean
• Remove all
previous build files
Post-clean
Mapping
Lifecycle
Clean Validate Compile
Test Package
Integration-
test
Verify Install Deploy
jslint plugin
jslint
Compiler plugin
compile testCompile
Cargo plugin
deploy run
Mapping
Lifecycle
Clean Validate Compile
Test Package
Integration-
test
Verify Install Deploy
Clean plugin
clean
jslint plugin
jslint
Compiler plugin
compile testCompile
Cargo plugin
deploy run
Mapping
Lifecycle
Clean Validate Compile
Test Package
Integration-
test
Verify Install Deploy
Clean plugin
clean
jslint plugin
jslint
Compiler plugin
compile testCompile
Cargo plugin
deploy run
Mapping
Lifecycle
Clean Validate Compile
Test Package
Integration-
test
Verify Install Deploy
Clean plugin
clean
Each plugin comes

with its goals bound
to lifecycle phases
In
 maven
 terminology
 such
 binding
 called
 MOJO
 
Its
 also
 predefines
 goal
 configuration
jslint plugin
jslint
Compiler plugin
compile testCompile
Cargo plugin
deploy run
Mapping
Lifecycle
Clean Validate Compile
Test Package
Integration-
test
Verify Install Deploy
Clean plugin
clean
Each plugin comes

with its goals bound
to lifecycle phases
jslint plugin
jslint
Compiler plugin
compile testCompile
Cargo plugin
deploy run
Mapping
Lifecycle
Clean Validate Compile
Test Package
Integration-
test
Verify Install Deploy
Clean plugin
clean
Each plugin comes

with its goals bound
to lifecycle phases
jslint plugin
jslint
Mapping
Lifecycle
Clean Validate Compile
Test Package
Integration-
test
Verify Install Deploy
Each plugin comes

with its goals bound
to lifecycle phases
jslint plugin
jslint
Mapping
Lifecycle
Clean Validate Compile
Test Package
Integration-
test
Verify Install Deploy
Each plugin comes

with its goals bound
to lifecycle phases
jslint plugin
jslint
Mapping
Lifecycle
Clean Validate Compile
Test Package
Integration-
test
Verify Install Deploy
Each plugin comes

with its goals bound
to lifecycle phases
TIP: to disable 

a preconfigured

plugin execution

change phase to

“none”
Package type
The specific goals bound to each phase default to a set of goals specific to a
project’s packaging.
Package type
The specific goals bound to each phase default to a set of goals specific to a
project’s packaging.
A project with packaging jar has a different set of default goals from a project
with a packaging of war.The packaging element affects the steps required to
build a project.
Package type
Package type
JAR is the default packaging type, the most common, and thus the most
commonly encountered lifecycle configuration.
Package type
JAR is the
commonly encountered lifecycle configuration.
POM is the simplest packaging type.The artifact that it generates is itself
only, rather than a JAR, SAR, or EAR.There is no code to test or compile, and
there are no resources the process.
Package type
JAR is the
commonly encountered lifecycle configuration.
POM is the simplest packaging type.The artifact that it generates is itself
only, rather than a JAR, SAR, or EAR.There is no code to test or compile, and
there are no resources the process.
TheWAR packaging type is similar to the JAR type.The exception being the
package goal of war:war. Note that the war:war goal requires a web.xml
configuration in your src/main/webapp/WEB-INF directory.
Package type
Dependencies mechanism
The cornerstone of the POM is its 

dependency list. Because most 

every project depends upon 

others to build and run correctly.
It happens with the Coordinates!
Dependencies
One powerful aspect of Maven is in its handling of project relationships; that
includes inheritance, aggregation (multi-module projects) and dependencies 

(it also includes transitive dependencies).
Dependencies
One powerful aspect of Maven is in its handling of project relationships; that
includes inheritance, aggregation (multi-module projects) and dependencies
(it also includes transitive dependencies).
Whats it transitive dependencies?

Maven brings the dependencies of the project dependencies, allowing your
dependency list to focus solely on project requirements.
Dependencies
One powerful aspect of Maven is in its handling of project relationships; that
includes inheritance, aggregation (multi-module projects) and dependencies
(it also includes transitive dependencies).
Whats it transitive dependencies?
Maven brings the dependencies of the project dependencies, allowing your
dependency list to focus solely on project requirements.
Dependency management has a long tradition of being a complicated mess for
anything but the most trivial of projects. Maven solves both problems through a
common local repository from which to link projects correctly, versions and all.
Scopes
compile provided
runtime test
system import
Compile Test Runtime
Classpath
Scopes
compile provided
runtime test
system import
Compile Test Runtime
Classpath
This is the default scope, used if
none is specified. Compile
dependencies are available in all
classpaths. Furthermore, those
dependencies are propagated to
dependent projects.
Scopes
compile provided
runtime test
system import
Compile Test Runtime
Classpath
This is much like compile, but
indicates you expect the JDK or a
container to provide it at
runtime. It is only available on
the compilation and test
classpath, and is not transitive.
Scopes
compile provided
runtime test
system import
Compile Test Runtime
Classpath
This scope indicates that the
dependency is not required for
compilation, but is for execution.
It is in the runtime and test
classpaths, but not the compile
classpath.
Scopes
compile provided
runtime test
system import
Compile Test Runtime
Classpath
This scope indicates that the
dependency is not required for
normal use of the application,
and is only available for the test
compilation and execution
phases.
Scopes
compile provided
runtime test
system import
Compile Test Runtime
Classpath
This scope is similar to provided
except that you have to provide
the JAR which contains it
explicitly.The artifact is always
available and is not looked up in
a repository.
Scopes
compile provided
runtime test
system import
Compile Test Runtime
Classpath
This scope used to import
dependencies defined in
configuration of the other
project
Scopes
compile provided
runtime test
system import
Compile Test Runtime
Classpath
Repositories
Local repository in %USER_HOME%/.m2/repository
Remote repository

Example: http://repo1.maven.org/maven2 or

another internal company repository, like nexus.wdf.sap.corp
The repository contains dependencies and plugins, can store any kind of
artifact: jar, war, pom, ejb, ear.
The repository can be managed by a“repository manager”like Nexus
Lifecycle
Maven
Project
pom.xml
source code
Lifecycle
Maven
Project
pom.xml
source code
reads the configuration
Lifecycle
Maven
Project
pom.xml
source code
fetches the dependencies
M2 local repo
Lifecycle
Maven
Project
pom.xml
source code
M2 local repo
NEXUS
fetches missing dependencies from the Internet into M2
Lifecycle
Maven
Project
pom.xml
source code
M2 local repo
NEXUS
fetches missing dependencies from the Internet into M2
Lifecycle
Maven
Project
pom.xml
source code
M2 local repo
NEXUS
target folder
copies the dependencies
Lifecycle
Maven
Project
pom.xml
source code
M2 local repo
NEXUS
target folder
build the project
Lifecycle
Maven
Project
pom.xml
source code
M2 local repo
NEXUS
target folder
deploys artifact to local repository
1 de 91

Recomendados

An Introduction to Maven Part 1 por
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1MD Sayem Ahmed
899 visualizações23 slides
Maven por
MavenMaven
MavenМарія Русин
1.9K visualizações49 slides
Maven for Dummies por
Maven for DummiesMaven for Dummies
Maven for DummiesTomer Gabel
6.3K visualizações9 slides
Maven Presentation - SureFire vs FailSafe por
Maven Presentation - SureFire vs FailSafeMaven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafeHolasz Kati
1.4K visualizações39 slides
An introduction to Maven por
An introduction to MavenAn introduction to Maven
An introduction to MavenJoao Pereira
7.9K visualizações78 slides
Build Automation using Maven por
Build Automation using Maven Build Automation using Maven
Build Automation using Maven Ankit Gubrani
3.7K visualizações45 slides

Mais conteúdo relacionado

Mais procurados

Maven Overview por
Maven OverviewMaven Overview
Maven OverviewFastConnect
8.5K visualizações29 slides
Maven Basics - Explained por
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - ExplainedSmita Prasad
1.1K visualizações46 slides
Maven por
MavenMaven
Mavenfeng lee
1.8K visualizações33 slides
Continuous Deployment Pipeline with maven por
Continuous Deployment Pipeline with mavenContinuous Deployment Pipeline with maven
Continuous Deployment Pipeline with mavenAlan Parkinson
7.6K visualizações31 slides
Apache Maven por
Apache MavenApache Maven
Apache MavenRahul Tanwani
2.1K visualizações35 slides
Introduction to Maven por
Introduction to MavenIntroduction to Maven
Introduction to MavenOnkar Deshpande
3.4K visualizações67 slides

Mais procurados(20)

Maven Overview por FastConnect
Maven OverviewMaven Overview
Maven Overview
FastConnect8.5K visualizações
Maven Basics - Explained por Smita Prasad
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
Smita Prasad1.1K visualizações
Maven por feng lee
MavenMaven
Maven
feng lee1.8K visualizações
Continuous Deployment Pipeline with maven por Alan Parkinson
Continuous Deployment Pipeline with mavenContinuous Deployment Pipeline with maven
Continuous Deployment Pipeline with maven
Alan Parkinson7.6K visualizações
Apache Maven por Rahul Tanwani
Apache MavenApache Maven
Apache Maven
Rahul Tanwani2.1K visualizações
Introduction to Maven por Onkar Deshpande
Introduction to MavenIntroduction to Maven
Introduction to Maven
Onkar Deshpande3.4K visualizações
Note - Apache Maven Intro por boyw165
Note - Apache Maven IntroNote - Apache Maven Intro
Note - Apache Maven Intro
boyw1652.6K visualizações
Introduction to Maven por Mindfire Solutions
Introduction to MavenIntroduction to Maven
Introduction to Maven
Mindfire Solutions959 visualizações
Maven por Khan625
Maven Maven
Maven
Khan625905 visualizações
Maven Introduction por Sandeep Chawla
Maven IntroductionMaven Introduction
Maven Introduction
Sandeep Chawla21.2K visualizações
An Introduction to Maven por Vadym Lotar
An Introduction to MavenAn Introduction to Maven
An Introduction to Maven
Vadym Lotar13.9K visualizações
Introduction to maven por Manos Georgopoulos
Introduction to mavenIntroduction to maven
Introduction to maven
Manos Georgopoulos1.2K visualizações
Demystifying Maven por Mike Desjardins
Demystifying MavenDemystifying Maven
Demystifying Maven
Mike Desjardins4.9K visualizações
Development Tools - Maven por Bert Koorengevel
Development Tools - MavenDevelopment Tools - Maven
Development Tools - Maven
Bert Koorengevel477 visualizações
maven por akd11
mavenmaven
maven
akd11375 visualizações
Version Management in Maven por Geert Pante
Version Management in MavenVersion Management in Maven
Version Management in Maven
Geert Pante11.9K visualizações
Maven 2 features por Angel Ruiz
Maven 2 featuresMaven 2 features
Maven 2 features
Angel Ruiz4.4K visualizações
Maven por Shraddha
MavenMaven
Maven
Shraddha416 visualizações
Maven ppt por natashasweety7
Maven pptMaven ppt
Maven ppt
natashasweety74.7K visualizações

Similar a Introduction to maven, its configuration, lifecycle and relationship to JS world

Apache maven, a software project management tool por
Apache maven, a software project management toolApache maven, a software project management tool
Apache maven, a software project management toolRenato Primavera
1.6K visualizações57 slides
Intelligent Projects with Maven - DevFest Istanbul por
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulMert Çalışkan
1.3K visualizações58 slides
Maven 2.0 - Project management and comprehension tool por
Maven 2.0 - Project management and comprehension toolMaven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension toolelliando dias
2K visualizações44 slides
(Re)-Introduction to Maven por
(Re)-Introduction to Maven(Re)-Introduction to Maven
(Re)-Introduction to MavenEric Wyles
127 visualizações30 slides
Exploring Maven SVN GIT por
Exploring Maven SVN GITExploring Maven SVN GIT
Exploring Maven SVN GITPeople Strategists
1.5K visualizações55 slides
BMO - Intelligent Projects with Maven por
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenMert Çalışkan
1.6K visualizações59 slides

Similar a Introduction to maven, its configuration, lifecycle and relationship to JS world(20)

Apache maven, a software project management tool por Renato Primavera
Apache maven, a software project management toolApache maven, a software project management tool
Apache maven, a software project management tool
Renato Primavera1.6K visualizações
Intelligent Projects with Maven - DevFest Istanbul por Mert Çalışkan
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest Istanbul
Mert Çalışkan1.3K visualizações
Maven 2.0 - Project management and comprehension tool por elliando dias
Maven 2.0 - Project management and comprehension toolMaven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension tool
elliando dias2K visualizações
(Re)-Introduction to Maven por Eric Wyles
(Re)-Introduction to Maven(Re)-Introduction to Maven
(Re)-Introduction to Maven
Eric Wyles127 visualizações
Exploring Maven SVN GIT por People Strategists
Exploring Maven SVN GITExploring Maven SVN GIT
Exploring Maven SVN GIT
People Strategists1.5K visualizações
BMO - Intelligent Projects with Maven por Mert Çalışkan
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with Maven
Mert Çalışkan1.6K visualizações
Maven in mulesoft por venkata20k
Maven in mulesoftMaven in mulesoft
Maven in mulesoft
venkata20k142 visualizações
Jenkins advance topic por Gourav Varma
Jenkins advance topicJenkins advance topic
Jenkins advance topic
Gourav Varma182 visualizações
Java, Eclipse, Maven & JSF tutorial por Raghavan Mohan
Java, Eclipse, Maven & JSF tutorialJava, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorial
Raghavan Mohan2K visualizações
Maven por Emprovise
MavenMaven
Maven
Emprovise1.2K visualizações
Mavennotes.pdf por AnkurSingh656748
Mavennotes.pdfMavennotes.pdf
Mavennotes.pdf
AnkurSingh65674810 visualizações
Maven por Jyothi Malapati
MavenMaven
Maven
Jyothi Malapati514 visualizações
Maven por Jyothi Malapati
MavenMaven
Maven
Jyothi Malapati1.7K visualizações
Maven por Fabio Bonfante
MavenMaven
Maven
Fabio Bonfante829 visualizações
P&MSP2012 - Maven por Daniele Dell'Aglio
P&MSP2012 - MavenP&MSP2012 - Maven
P&MSP2012 - Maven
Daniele Dell'Aglio484 visualizações
Wonderful World of Maven por Justin J. Moses
Wonderful World of MavenWonderful World of Maven
Wonderful World of Maven
Justin J. Moses1K visualizações
Maven por Nishant Arora
MavenMaven
Maven
Nishant Arora98 visualizações
Maven: Managing Software Projects for Repeatable Results por Steve Keener
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable Results
Steve Keener707 visualizações
Jenkins advance topic por Kalkey
Jenkins advance topicJenkins advance topic
Jenkins advance topic
Kalkey70 visualizações

Último

Page Object Model por
Page Object ModelPage Object Model
Page Object Modelartembondar5
6 visualizações5 slides
Understanding HTML terminology por
Understanding HTML terminologyUnderstanding HTML terminology
Understanding HTML terminologyartembondar5
6 visualizações8 slides
tecnologia18.docx por
tecnologia18.docxtecnologia18.docx
tecnologia18.docxnosi6702
5 visualizações5 slides
The Path to DevOps por
The Path to DevOpsThe Path to DevOps
The Path to DevOpsJohn Valentino
5 visualizações6 slides
Playwright Retries por
Playwright RetriesPlaywright Retries
Playwright Retriesartembondar5
5 visualizações1 slide
Generic or specific? Making sensible software design decisions por
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
6 visualizações60 slides

Último(20)

Page Object Model por artembondar5
Page Object ModelPage Object Model
Page Object Model
artembondar56 visualizações
Understanding HTML terminology por artembondar5
Understanding HTML terminologyUnderstanding HTML terminology
Understanding HTML terminology
artembondar56 visualizações
tecnologia18.docx por nosi6702
tecnologia18.docxtecnologia18.docx
tecnologia18.docx
nosi67025 visualizações
The Path to DevOps por John Valentino
The Path to DevOpsThe Path to DevOps
The Path to DevOps
John Valentino5 visualizações
Playwright Retries por artembondar5
Playwright RetriesPlaywright Retries
Playwright Retries
artembondar55 visualizações
Generic or specific? Making sensible software design decisions por Bert Jan Schrijver
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
Bert Jan Schrijver6 visualizações
Ports-and-Adapters Architecture for Embedded HMI por Burkhard Stubert
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMI
Burkhard Stubert26 visualizações
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with... por sparkfabrik
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
sparkfabrik8 visualizações
EV Charging App Case por iCoderz Solutions
EV Charging App Case EV Charging App Case
EV Charging App Case
iCoderz Solutions9 visualizações
The Era of Large Language Models.pptx por AbdulVahedShaik
The Era of Large Language Models.pptxThe Era of Large Language Models.pptx
The Era of Large Language Models.pptx
AbdulVahedShaik7 visualizações
predicting-m3-devopsconMunich-2023-v2.pptx por Tier1 app
predicting-m3-devopsconMunich-2023-v2.pptxpredicting-m3-devopsconMunich-2023-v2.pptx
predicting-m3-devopsconMunich-2023-v2.pptx
Tier1 app9 visualizações
Using Qt under LGPL-3.0 por Burkhard Stubert
Using Qt under LGPL-3.0Using Qt under LGPL-3.0
Using Qt under LGPL-3.0
Burkhard Stubert13 visualizações
Navigating container technology for enhanced security by Niklas Saari por Metosin Oy
Navigating container technology for enhanced security by Niklas SaariNavigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas Saari
Metosin Oy14 visualizações
Introduction to Git Source Control por John Valentino
Introduction to Git Source ControlIntroduction to Git Source Control
Introduction to Git Source Control
John Valentino6 visualizações
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated... por TomHalpin9
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
TomHalpin96 visualizações
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx por animuscrm
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
animuscrm15 visualizações
Keep por Geniusee
KeepKeep
Keep
Geniusee78 visualizações
ADDO_2022_CICID_Tom_Halpin.pdf por TomHalpin9
ADDO_2022_CICID_Tom_Halpin.pdfADDO_2022_CICID_Tom_Halpin.pdf
ADDO_2022_CICID_Tom_Halpin.pdf
TomHalpin95 visualizações
AI and Ml presentation .pptx por FayazAli87
AI and Ml presentation .pptxAI and Ml presentation .pptx
AI and Ml presentation .pptx
FayazAli8713 visualizações

Introduction to maven, its configuration, lifecycle and relationship to JS world

  • 5. The maven project was originally started as an attempt to simplify the build processes. Maven addresses two aspects of building software: First, it describes how software is built, and second, it describes its dependencies. pom.xml compiled code artifact jar/war/ othertests coverage documentation quality report
  • 6. What maven can do? Centralize project information such as build metadata, properties, version control systems, developers in project object model file (pom.xml). Manage our build process; does project build tasks such as compilation, unit testing, integration testing, quality metrics, documentation generation as it required for the successful delivery. Manage project library and resources dependencies. Manage project artifacts deployment to corporate/public repositories.
  • 7. Maven plugins Maven is actually a plugin execution framework where every task is actually done by plugins. A plugin provides a set of actions or commands (in maven terminology called goals) that can be executed to perform a task. There are plugins for building, testing, source control management, running a web server, generating project files and much more. Some basic plugins are included in every project by default, and they have sensible default settings.
  • 8. Maven plugins suite Core clean compiler deploy failsafe install resources site surefire verifier Reporting Changelog Changes Checkstyle Clover Javadocs PMD Surefire-reports Local servers Cargo jaxme jetty tomcat Tools Ant Antlr Antrun Archetype Assembly Help Release Packaging jar war ear ejb rar pom shade IDE integration eclipse idea
  • 9. Maven plugins suite Core clean compiler deploy failsafe install resources site surefire verifier Reporting Changelog Changes Checkstyle Clover Javadocs PMD Surefire-reports Local servers Cargo jaxme jetty tomcat Tools Ant Antlr Antrun Archetype Assembly Help Release Packaging jar war ear ejb rar pom shade IDE integration eclipse idea And
  • 13. Maven plugin goals A plugin generally provides a set of goals and which can be executed using following syntax:
 mvn [plugin-name]:[goal-name]
  • 14. Maven plugin goals A plugin generally provides a set of goals and which can be executed using following syntax: mvn [plugin-name]:[goal-name] For example, a Java project can be compiled with the maven-compiler- plugin's compile-goal by running following command:
 my-project-dir mvn compiler:compile
  • 15. Maven plugin goals A plugin generally provides a set of goals and which can be executed using following syntax: mvn [plugin-name]:[goal-name] For example, a Java project can be compiled with the maven-compiler- plugin's compile-goal by running following command: my-project-dir You can get information about plugin and its goals using maven help plugin:
 mvn help:describe -Dplugin=compiler
  • 16. Maven plugin goals A plugin generally provides a set of goals and which can be executed using following syntax: mvn [plugin-name]:[goal-name] For example, a Java project can be compiled with the maven-compiler- plugin's compile-goal by running following command: my-project-dir You can get information about plugin and its goals using maven help plugin:
 mvn help:describe -Dplugin=compiler
  • 18. Project Object Model (POM) A Project Object Model or POM is the fundamental unit of work in Maven. It’s an XML file that contains information about the project and configuration details used by Maven to build the project. The configuration that can be specified in the POM are the project dependencies, the plugins or goals that can be executed, the build profiles, and so on. When executing a task or goal, Maven looks for the POM in the current working directory, but you can explicitly tell to maven path of POM file:
 mvn -f path/to/pom.xml
  • 20. Coordinates.What??? Every maven project is identified by its GAV coordinates. groupId (G) - It’s an identifier for a collection of related modules.
 This is usually a hierarchy that starts with the organization that produced the modules, and then possibly moves into increasingly more specialized projects, e.g. com.sap.ui5 or com.sap.fiori. G A V
  • 21. Coordinates.What??? artifact (A) - It’s a unique identifier or a simple name that is given to a module within a group There can be multiple modules in a group.
 If a group has a module called webapp, its artifactId will be“webapp”. G A V
  • 22. Coordinates.What??? version (V) - It’s an identifier for the release or build number of project,
 e.g. 1.0 or 1.0-SNAPSHOT G A V
  • 23. Coordinates.What??? version (V) - It’s an identifier for the release or build number of project, e.g. 1.0 or 1.0-SNAPSHOT Now what’s this SNAPSHOT? G A V
  • 24. Versioning strategy There are two types of versions: release and snapshot. Releases - a version that is assumed never to change.
 Only to be used for a single state of the project when it is released and then updated to the next snapshot Snapshot - used by projects during development as it implies that development is still occurring that project may change G A V
  • 27. Simplest pom.xml mvn install { compile code run tests package as jar deploy to local repo
  • 28. How all this can be done from 6 lines of xml?
  • 30. Super POM The modelVersion property defines the super POM 
 file (org/apache/maven/model/pom-4.0.0.xml)
  • 31. Super POM The modelVersion property defines the super POM 
 file (org/apache/maven/model/pom-4.0.0.xml)
  • 32. Super POM The modelVersion property defines the super POM 
 file (org/apache/maven/model/pom-4.0.0.xml) Standard
  • 35. Super POM The modelVersion property defines the super POM 
 file (org/apache/maven/model/pom-4.0.0.xml) properties
 interpolation
  • 36. Super POM The modelVersion property defines the super POM 
 file (org/apache/maven/model/pom-4.0.0.xml)
  • 37. Super POM The modelVersion property defines the super POM file (org/apache/maven/model/pom-4.0.0.xml) Work with the same analogy as objectsinheritance Effec%ve'POM' POM' Parent' POM' Super' POM'
  • 38. Super POM The modelVersion property defines the super POM file (org/apache/maven/model/pom-4.0.0.xml) Work with the same analogy as To see the merged pom:
 mvn help:effective-pom Effec%ve'POM' POM' Parent' POM' Super' POM'
  • 39. Property references env.*
 Environment variables exposed by OS or Shell
 ${env.JAVA_HOME} project.*
 POM elemens
 ${project.groupId} ${project.parent.groupId} settings.*
 Maven settings.xml properties
 ${settings.localRepository} Custom properties
 ${foo}
  • 40. Build Lifecycle In maven, the build is run is a predefined ordered set of steps called the build lifecycle. The individual steps are called phases and the same phases are run for every maven build using the default lifecycle, no matter what it produce. The build task that will be performed during each phase are determined by the configuration in the project file, and in particular in the selected packaging.
  • 41. Build lifecycle Validate •  Validate the project is correct and all necessary information is available Compile •  Compile the source code of the project Test •  Test the compiled 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 distributable format, such as a JAR Integration-test •  Process and deploy the package if necessary into a environment where integration tests can run Verify •  Run any checks to verify the package is valid and meets the quality criteria Install •  Install the package into the local repository, for use as a dependency for other projects locally Deploy •  Done in integration or release environment, copies the final package to the local repository, then deploy the installed package in a specified environment. Default 
 Lifecycle (collectionofbuildphases)
  • 42. Build lifecycle mvn install Validate •  Validate the project is correct and all necessary information is available Compile •  Compile the source code of the project Test •  Test the compiled 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 distributable format, such as a JAR Integration-test •  Process and deploy the package if necessary into a environment where integration tests can run Verify •  Run any checks to verify the package is valid and meets the quality criteria Install •  Install the package into the local repository, for use as a dependency for other projects locally Deploy •  Done in integration or release environment, copies the final package to the local repository, then deploy the installed package in a specified environment. X
  • 43. Build lifecycle Validate •  Validate the project is correct and all necessary information is available Compile •  Compile the source code of the project Test •  Test the compiled 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 distributable format, such as a JAR Integration-test •  Process and deploy the package if necessary into a environment where integration tests can run Verify •  Run any checks to verify the package is valid and meets the quality criteria Install •  Install the package into the local repository, for use as a dependency for other projects locally Deploy •  Done in integration or release environment, copies the final package to the local repository, then deploy the installed package in a specified environment. X mvn clean install +Pre-clean Clean • Remove all previous build files Post-clean
  • 44. Mapping Lifecycle Clean Validate Compile Test Package Integration- test Verify Install Deploy
  • 45. jslint plugin jslint Compiler plugin compile testCompile Cargo plugin deploy run Mapping Lifecycle Clean Validate Compile Test Package Integration- test Verify Install Deploy Clean plugin clean
  • 46. jslint plugin jslint Compiler plugin compile testCompile Cargo plugin deploy run Mapping Lifecycle Clean Validate Compile Test Package Integration- test Verify Install Deploy Clean plugin clean
  • 47. jslint plugin jslint Compiler plugin compile testCompile Cargo plugin deploy run Mapping Lifecycle Clean Validate Compile Test Package Integration- test Verify Install Deploy Clean plugin clean Each plugin comes
 with its goals bound to lifecycle phases In
  • 59. jslint plugin jslint Compiler plugin compile testCompile Cargo plugin deploy run Mapping Lifecycle Clean Validate Compile Test Package Integration- test Verify Install Deploy Clean plugin clean Each plugin comes
 with its goals bound to lifecycle phases
  • 60. jslint plugin jslint Compiler plugin compile testCompile Cargo plugin deploy run Mapping Lifecycle Clean Validate Compile Test Package Integration- test Verify Install Deploy Clean plugin clean Each plugin comes
 with its goals bound to lifecycle phases
  • 61. jslint plugin jslint Mapping Lifecycle Clean Validate Compile Test Package Integration- test Verify Install Deploy Each plugin comes
 with its goals bound to lifecycle phases
  • 62. jslint plugin jslint Mapping Lifecycle Clean Validate Compile Test Package Integration- test Verify Install Deploy Each plugin comes
 with its goals bound to lifecycle phases
  • 63. jslint plugin jslint Mapping Lifecycle Clean Validate Compile Test Package Integration- test Verify Install Deploy Each plugin comes
 with its goals bound to lifecycle phases TIP: to disable 
 a preconfigured
 plugin execution
 change phase to
 “none”
  • 65. The specific goals bound to each phase default to a set of goals specific to a project’s packaging. Package type
  • 66. The specific goals bound to each phase default to a set of goals specific to a project’s packaging. A project with packaging jar has a different set of default goals from a project with a packaging of war.The packaging element affects the steps required to build a project. Package type
  • 68. JAR is the default packaging type, the most common, and thus the most commonly encountered lifecycle configuration. Package type
  • 69. JAR is the commonly encountered lifecycle configuration. POM is the simplest packaging type.The artifact that it generates is itself only, rather than a JAR, SAR, or EAR.There is no code to test or compile, and there are no resources the process. Package type
  • 70. JAR is the commonly encountered lifecycle configuration. POM is the simplest packaging type.The artifact that it generates is itself only, rather than a JAR, SAR, or EAR.There is no code to test or compile, and there are no resources the process. TheWAR packaging type is similar to the JAR type.The exception being the package goal of war:war. Note that the war:war goal requires a web.xml configuration in your src/main/webapp/WEB-INF directory. Package type
  • 71. Dependencies mechanism The cornerstone of the POM is its 
 dependency list. Because most 
 every project depends upon 
 others to build and run correctly. It happens with the Coordinates!
  • 72. Dependencies One powerful aspect of Maven is in its handling of project relationships; that includes inheritance, aggregation (multi-module projects) and dependencies 
 (it also includes transitive dependencies).
  • 73. Dependencies One powerful aspect of Maven is in its handling of project relationships; that includes inheritance, aggregation (multi-module projects) and dependencies (it also includes transitive dependencies). Whats it transitive dependencies?
 Maven brings the dependencies of the project dependencies, allowing your dependency list to focus solely on project requirements.
  • 74. Dependencies One powerful aspect of Maven is in its handling of project relationships; that includes inheritance, aggregation (multi-module projects) and dependencies (it also includes transitive dependencies). Whats it transitive dependencies? Maven brings the dependencies of the project dependencies, allowing your dependency list to focus solely on project requirements. Dependency management has a long tradition of being a complicated mess for anything but the most trivial of projects. Maven solves both problems through a common local repository from which to link projects correctly, versions and all.
  • 75. Scopes compile provided runtime test system import Compile Test Runtime Classpath
  • 76. Scopes compile provided runtime test system import Compile Test Runtime Classpath This is the default scope, used if none is specified. Compile dependencies are available in all classpaths. Furthermore, those dependencies are propagated to dependent projects.
  • 77. Scopes compile provided runtime test system import Compile Test Runtime Classpath This is much like compile, but indicates you expect the JDK or a container to provide it at runtime. It is only available on the compilation and test classpath, and is not transitive.
  • 78. Scopes compile provided runtime test system import Compile Test Runtime Classpath This scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath.
  • 79. Scopes compile provided runtime test system import Compile Test Runtime Classpath This scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases.
  • 80. Scopes compile provided runtime test system import Compile Test Runtime Classpath This scope is similar to provided except that you have to provide the JAR which contains it explicitly.The artifact is always available and is not looked up in a repository.
  • 81. Scopes compile provided runtime test system import Compile Test Runtime Classpath This scope used to import dependencies defined in configuration of the other project
  • 82. Scopes compile provided runtime test system import Compile Test Runtime Classpath
  • 83. Repositories Local repository in %USER_HOME%/.m2/repository Remote repository
 Example: http://repo1.maven.org/maven2 or
 another internal company repository, like nexus.wdf.sap.corp The repository contains dependencies and plugins, can store any kind of artifact: jar, war, pom, ejb, ear. The repository can be managed by a“repository manager”like Nexus
  • 87. Lifecycle Maven Project pom.xml source code M2 local repo NEXUS fetches missing dependencies from the Internet into M2
  • 88. Lifecycle Maven Project pom.xml source code M2 local repo NEXUS fetches missing dependencies from the Internet into M2
  • 89. Lifecycle Maven Project pom.xml source code M2 local repo NEXUS target folder copies the dependencies
  • 90. Lifecycle Maven Project pom.xml source code M2 local repo NEXUS target folder build the project
  • 91. Lifecycle Maven Project pom.xml source code M2 local repo NEXUS target folder deploys artifact to local repository
  • 94. Aggregation Project A Project B Project C cd A
 mvn clean install
 cd .. cd B
 mvn clean install
 cd ..
 cd C mvn clean install Depends Depends }8 lines!!!
  • 97. Debugging maven Output full error stack trace:
 maven anygoal -e Output for debugging
 maven anygoal -X
  • 98. settings.xml The settings.xml file contains configuration of Maven execution. Settings in this file are settings which apply to many projects and which should not be bundled to any specific project, or distributed to an audience.These include values such as the local repository location, alternate remote repository servers, and authentication information.
  • 99. settings.xml The settings.xml file contains configuration of Maven execution. Settings in this file are settings which apply to many projects and which should not be bundled to any specific project, or distributed to an audience.These include values such as the local repository location, alternate remote repository servers, and authentication information. Maven provides 2 settings files:
 Local settings.xml at %USER_HOME%/.m2/settings.xml
 Global settings.xml at %M2_HOME%/conf/settings.xml
  • 100. settings.xml The settings.xml file contains configuration of Maven execution. Settings in this file are settings which apply to many projects and which should not be bundled to any specific project, or distributed to an audience.These include values such as the local repository location, alternate remote repository servers, and authentication information. Maven provides 2 settings files: Local settings.xml at %USER_HOME%/.m2/settings.xml Global settings.xml at %M2_HOME%/conf/settings.xml These files are not bundled with Maven project and don’t get distributed
  • 101. settings.xml The settings.xml file contains configuration of Maven execution. Settings in this file are settings which apply to many projects and which should not be bundled to any specific project, or distributed to an audience.These include values such as the local repository location, alternate remote repository servers, and authentication information. Maven provides 2 settings files: Local settings.xml at %USER_HOME%/.m2/settings.xml Global settings.xml at %M2_HOME%/conf/settings.xml These files are not bundled with Maven project and don’t get distributed If both files exists, their content get merged
  • 102. settings.xml The settings.xml file contains configuration of Maven execution. Settings in this file are settings which apply to many projects and which should not be bundled to any specific project, or distributed to an audience.These include values such as the local repository location, alternate remote repository servers, and authentication information. Maven provides 2 settings files: Local settings.xml at %USER_HOME%/.m2/settings.xml Global settings.xml at %M2_HOME%/conf/settings.xml These files are not bundled with Maven project and don’t get distributed If both files exists, their content get merged Local settings.xml overrides the global one
  • 103. settings.xml The settings.xml file contains configuration of Maven execution. Settings in this file are settings which apply to many projects and which should not be bundled to any specific project, or distributed to an audience.These include values such as the local repository location, alternate remote repository servers, and authentication information. Maven provides 2 settings files: Local settings.xml at %USER_HOME%/.m2/settings.xml Global settings.xml at %M2_HOME%/conf/settings.xml These files are not bundled with Maven project and don’t get distributed If both files exists, their content get merged Local settings.xml overrides the global one
  • 104. settings.xml The settings.xml file contains configuration of Maven execution. Settings in this file are settings which apply to many projects and which should not be bundled to any specific project, or distributed to an audience.These include values such as the local repository location, alternate remote repository servers, and authentication information. Maven provides 2 settings files: Local settings.xml at %USER_HOME%/.m2/settings.xml Global settings.xml at %M2_HOME%/conf/settings.xml These files are not bundled with Maven project and don’t get distributed If both files exists, their content get merged Local settings.xml overrides the global one
  • 105. Common criticism of maven Poor documentation - Lots of maven documentation is automatically generated and is generally pretty horrible. Simple things are pretty counterintuitive in maven, e.g. copying a file Maven adds to the number of places you need to look when something breaks - both your source code, local repository and the remote repository. Everything breaks if someone changes an artifactId or groupId Doesn’t work well if your network connectivity is unreliable or unavailable A huge output log
  • 106. Maven + NPM + Grunt eirslett/frontend-maven-plugin This plugin downloads/installs Node and NPM locally for your project, runs NPM install, installs bower dependencies, run Grunt and/or gulp and/or Karma. It's supposed to work onWindows, OS X and Linux.
  • 107. Maven + NPM + Grunt eirslett/frontend-maven-plugin This plugin downloads/installs Node and NPM locally for your project, runs NPM install, installs bower dependencies, run Grunt and/or gulp and/or Karma. It's supposed to work onWindows, OS X and Linux.
  • 108. Thanks