SlideShare une entreprise Scribd logo
1  sur  45
Télécharger pour lire hors ligne
Build Automation With maven
(By Ankit Gubrani)
Agenda
q What is maven?
q Why maven?
q Maven Installation.
q How maven works.
q The build Lifecycle.
q Basics of POM, Profiles, Repositories.
q Maven Plugins.
q Maven Dependency.
q Creating custom maven Plugin.
What is maven ?
Any Idea?
Ok but before that !
What is a build tool?
Build Tool
q A build tool is a programming utility that is used when
building a new version of a program.
q Build tools are tools to manage and organise your
builds.
Now that you know What Build Tool is.
Here is Maven -
Maven
q Maven is a popular open source build tool used primarily
for Java projects. It was designed to make build
process easier task.
q Apart from being a build tool Maven can also manage
reporting and documentation from a central piece of
information.
q It is based on the concept of a project object model
(POM).
q Maven is more than just a "build tool" rather is a
project management tool.
Maven provides developers ways to manage following:
q Builds
q Documentation
q Reporting
q Dependencies
q SCMs
q Releases
q Distribution
q Mailing list
Why Maven if we have other Build tools
available ???
Comparison
Here are some of the benefits of using Maven over any
other build (Ant, make etc) :
q Standardized project layout. (Convention over
configuration unlike ANT)
q Automatic dependency handling.(Ant can't do this
unassisted)
q Large Existing repository.
q Reusability ( through Maven Plugins).
Maven Installation
Installation
q Maven is a Java tool, so you must have Java installed in
order to proceed.
q Follow the instructions on the link for intallation :
http://maven.apache.org/download.cgi#Installatio
n
q Once installation is done type the following command in
a terminal or in a command prompt:
mvn –version
It should print out your installed version of Maven
Maven Build Lifecycle
Lifecycle
q Build Lifecycle is a well defined sequence of phases
which define the order in which the goals are to be
executed. Here phase represents a stage in life cycle.
q When Maven starts building a project, it steps through
a defined sequence of phases and executes goals which
are registered with each phase. Maven has following
three standard lifecycles:
q Clean
q default(or build)
q Site
q A Build Lifecycle is Made Up of Phases.
q A Build Phase is Made Up of Plugin Goals.
q A Plugin Goal represents a specific task (finer than a
build phase) which contributes to the building and
managing of a project.
lPhase-Goal Binding
lLifecycle-Phase Binding
POM
lProject Object Model
q POM stands for Project Object Model. It is
fundamental Unit of work in Maven.
q It is an XML file. It always resides in the base
directory of the project as pom.xml.
q The POM contains information about the project and
various configuration detail used by Maven to build the
project.
lSome of the configuration that can be specified in the
POM are following:
q project dependencies
q plugins
q goals
q build profiles
q project version
q developers
q mailing list
Maven Repository
q A maven repository is a directory of packaged JAR file with
pom.xml file. Maven searches for dependencies in the
repositories. There are 3 types of maven repostory :
§ Local Repository
§ Central Repository
§ Remote Repository
q Maven searches for the dependencies in the following order:
q Local repository then Central repository then Remote
repository.
q Local Repository :-
§ Maven local repository is located in your local
system. It is created by the maven when you run
any maven command.
§ By default, maven local repository is
%USER_HOME%/.m2 directory. For example:
C:UsersSSS IT.m2.
q Central Repository :-
§ Maven central repository is located on the web. It
has been created by the apache maven community
itself.
§ The path of central repository is:
http://repo1.maven.org/maven2 .
q Remote Repository :-
§ Maven remote repository is located on the web.
Most of libraries can be missing from the central
repository such as JBoss library etc, so we need to
define remote repository in pom.xml file.
Build Profile
q A Build profile is a set of configuration values which can be
used to set or override default values of Maven build. Using
a build profile, you can customize build for different
environments such as Production v/s Development
environments.
q Build profiles are majorly of three types :
§ Per Project :- Defined in the project POM file, pom.xml
§ Per User :- Defined in Maven settings xml file
(%USER_HOME%/.m2/settings.xml)
§ Global :- Defined in Maven global settings xml file
(%M2_HOME%/conf/settings.xml)
Maven Plugins
q Plugins are the central feature of Maven that allow for the
reuse of common build logic across multiple projects.
q Maven is actually a plugin execution framework where every
task is actually done by plugins.
q A plugin generally provides a set of goals and which can be
executed using following syntax:
ü mvn [plugin-name]:[goal-name]
q There are plugins for almost every task in maven like plugins
are used to: create jar files, create war files, compile code,
unit test code, create project documentation, and on and on.
q Maven provides following two types of Plugins:
1)Build plugins:- They execute during the build and should be
configured in the <build/> element of pom.xml .
2)Reporting plugins:-They execute during the site
generation and they should be configured in the
<reporting/> element of the pom.xml .
Archetype
lAn archetype is defined as an original pattern or model from
which all other things of the same kind are made.
lMaven provides users,a very large list of different types of
project templates using concept of Archetype. Maven helps
users to quickly start a new java project using following
command :
mvn archetype:generate
lArchetype is a Maven plugin whose task is to create a project
structure as per its template. Archetype Plugin allows the user
to create a Maven project from an existing template called an
archetype.
Archetype
Now that you know basics of maven,
Let's create a maven project
q For creating any project maven provides templates(Archetype),
using which one can create by selecting any one archetype from
available archetypes.
q To start a new Maven project, use the Maven Archetype plugin from
the command line. Run the following command :-
§ mvn archetype:generate -DarchetypeGroupId=[Group Id] -
DarchetypeArtifactId= [Artifact ID]
q You can search for all archetypes provided by maven at there
central repository (http://search.maven.org/) and all other 3rd
party archetypes at any remote repository like -
http://mvnrepository.com
Demo
Maven Snapshots
q SNAPSHOT is a special version that indicates a current
development copy.
q Unlike regular versions, Maven checks for a new
SNAPSHOT version in a remote repository for every build.
q Snapshot vs Version :-
q In case of Version, if Maven once downloaded the mentioned
version say data-service:1.0, it will never try to download a
newer 1.0 available in repository. To download the updated
code, artifact version is be upgraded to 1.1.
q In case of SNAPSHOT, Maven will automatically fetch the
latest SNAPSHOT (data-service:1.0-SNAPSHOT)
everytime app-ui team build their project.
Hey did you notice ???
What we did till now automated the build
process. And this is called Build
Automation using Maven
Auto-Generated Project Documentation
Using maven
q Team communication is an essential part of any
project. And wasting time looking for technical project
information can be costly and frustrating. Clearly, any
IT project will benefit from having its own dedicated
technical Website.
q That's where the Maven site generator steps in. With
little effort, you can have a professional-quality, low
maintenance project Website up and running in no time.
q Documentation is generated by running
§ mvn site
Any Questions ?
lAbout Me
.about-me{
name: Ankit Gubrani !Sr. AEM Developer;
email-id: ankit.gubrani@codebrains.co.in;
LinkedIn: in.linkedin.com/in/ankitgubrani;
twitter: @ankitgubrani90;
blog: codebrains.blogspot.in;
website : codebrains.co.in;
}
Thank You
Please contact me at : ankit.gubrani@codebrains.co.in

Contenu connexe

Tendances

DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...Simplilearn
 
An Introduction To Jenkins
An Introduction To JenkinsAn Introduction To Jenkins
An Introduction To JenkinsKnoldus Inc.
 
Modern CI/CD Pipeline Using Azure DevOps
Modern CI/CD Pipeline Using Azure DevOpsModern CI/CD Pipeline Using Azure DevOps
Modern CI/CD Pipeline Using Azure DevOpsGlobalLogic Ukraine
 
Jenkins Introduction
Jenkins IntroductionJenkins Introduction
Jenkins IntroductionPavan Gupta
 
Build CICD Pipeline for Container Presentation Slides
Build CICD Pipeline for Container Presentation SlidesBuild CICD Pipeline for Container Presentation Slides
Build CICD Pipeline for Container Presentation SlidesAmazon Web Services
 
Learning Docker from Square One
Learning Docker from Square OneLearning Docker from Square One
Learning Docker from Square OneDocker, Inc.
 
DevOps Interview Questions and Answers 2019 | DevOps Tutorial | Edureka
DevOps Interview Questions and Answers 2019 | DevOps Tutorial | EdurekaDevOps Interview Questions and Answers 2019 | DevOps Tutorial | Edureka
DevOps Interview Questions and Answers 2019 | DevOps Tutorial | EdurekaEdureka!
 
Continuous integration
Continuous integrationContinuous integration
Continuous integrationamscanne
 
CI and CD with Jenkins
CI and CD with JenkinsCI and CD with Jenkins
CI and CD with JenkinsMartin Málek
 

Tendances (20)

DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
An Introduction To Jenkins
An Introduction To JenkinsAn Introduction To Jenkins
An Introduction To Jenkins
 
Modern CI/CD Pipeline Using Azure DevOps
Modern CI/CD Pipeline Using Azure DevOpsModern CI/CD Pipeline Using Azure DevOps
Modern CI/CD Pipeline Using Azure DevOps
 
Jenkins
JenkinsJenkins
Jenkins
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
 
Maven
MavenMaven
Maven
 
Spring boot
Spring bootSpring boot
Spring boot
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
Jenkins Introduction
Jenkins IntroductionJenkins Introduction
Jenkins Introduction
 
Build CICD Pipeline for Container Presentation Slides
Build CICD Pipeline for Container Presentation SlidesBuild CICD Pipeline for Container Presentation Slides
Build CICD Pipeline for Container Presentation Slides
 
Learning Docker from Square One
Learning Docker from Square OneLearning Docker from Square One
Learning Docker from Square One
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
DevOps introduction
DevOps introductionDevOps introduction
DevOps introduction
 
DevOps Interview Questions and Answers 2019 | DevOps Tutorial | Edureka
DevOps Interview Questions and Answers 2019 | DevOps Tutorial | EdurekaDevOps Interview Questions and Answers 2019 | DevOps Tutorial | Edureka
DevOps Interview Questions and Answers 2019 | DevOps Tutorial | Edureka
 
Continuous integration
Continuous integrationContinuous integration
Continuous integration
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
Jenkins CI presentation
Jenkins CI presentationJenkins CI presentation
Jenkins CI presentation
 
Introduction to gradle
Introduction to gradleIntroduction to gradle
Introduction to gradle
 
CI and CD with Jenkins
CI and CD with JenkinsCI and CD with Jenkins
CI and CD with Jenkins
 

En vedette

Version Management in Maven
Version Management in MavenVersion Management in Maven
Version Management in MavenGeert Pante
 
Automated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yardsAutomated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yardsJohn Ferguson Smart Limited
 
DevOps and Continuous Delivery Reference Architectures (including Nexus and o...
DevOps and Continuous Delivery Reference Architectures (including Nexus and o...DevOps and Continuous Delivery Reference Architectures (including Nexus and o...
DevOps and Continuous Delivery Reference Architectures (including Nexus and o...Sonatype
 
Continuous Deployment Pipeline with maven
Continuous Deployment Pipeline with mavenContinuous Deployment Pipeline with maven
Continuous Deployment Pipeline with mavenAlan Parkinson
 
Tech Talk #5 : Code Analysis SonarQube - Lương Trọng Nghĩa
Tech Talk #5 : Code Analysis SonarQube - Lương Trọng NghĩaTech Talk #5 : Code Analysis SonarQube - Lương Trọng Nghĩa
Tech Talk #5 : Code Analysis SonarQube - Lương Trọng NghĩaNexus FrontierTech
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with MavenSid Anand
 
Selenium Test Automation
Selenium Test AutomationSelenium Test Automation
Selenium Test AutomationBabuDevanandam
 
Mastering Maven 2.0 In 1 Hour V1.3
Mastering Maven 2.0 In 1 Hour V1.3Mastering Maven 2.0 In 1 Hour V1.3
Mastering Maven 2.0 In 1 Hour V1.3Matthew McCullough
 
An introduction to Maven
An introduction to MavenAn introduction to Maven
An introduction to MavenJoao Pereira
 
Continuous integration and delivery for java based web applications
Continuous integration and delivery for java based web applicationsContinuous integration and delivery for java based web applications
Continuous integration and delivery for java based web applicationsSunil Dalal
 
Continuous Delivery
Continuous DeliveryContinuous Delivery
Continuous DeliveryMike McGarr
 

En vedette (20)

Apache Maven
Apache MavenApache Maven
Apache Maven
 
Version Management in Maven
Version Management in MavenVersion Management in Maven
Version Management in Maven
 
Demystifying Maven
Demystifying MavenDemystifying Maven
Demystifying Maven
 
Continuous delivery-with-maven
Continuous delivery-with-mavenContinuous delivery-with-maven
Continuous delivery-with-maven
 
Automated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yardsAutomated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yards
 
DevOps and Continuous Delivery Reference Architectures (including Nexus and o...
DevOps and Continuous Delivery Reference Architectures (including Nexus and o...DevOps and Continuous Delivery Reference Architectures (including Nexus and o...
DevOps and Continuous Delivery Reference Architectures (including Nexus and o...
 
Continuous Deployment Pipeline with maven
Continuous Deployment Pipeline with mavenContinuous Deployment Pipeline with maven
Continuous Deployment Pipeline with maven
 
Apache maven 2 overview
Apache maven 2 overviewApache maven 2 overview
Apache maven 2 overview
 
Tech Talk #5 : Code Analysis SonarQube - Lương Trọng Nghĩa
Tech Talk #5 : Code Analysis SonarQube - Lương Trọng NghĩaTech Talk #5 : Code Analysis SonarQube - Lương Trọng Nghĩa
Tech Talk #5 : Code Analysis SonarQube - Lương Trọng Nghĩa
 
Maven overview
Maven overviewMaven overview
Maven overview
 
Maven
Maven Maven
Maven
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with Maven
 
Hibernate 3
Hibernate 3Hibernate 3
Hibernate 3
 
Selenium Test Automation
Selenium Test AutomationSelenium Test Automation
Selenium Test Automation
 
Hibernate
HibernateHibernate
Hibernate
 
Maven and ANT
Maven and ANTMaven and ANT
Maven and ANT
 
Mastering Maven 2.0 In 1 Hour V1.3
Mastering Maven 2.0 In 1 Hour V1.3Mastering Maven 2.0 In 1 Hour V1.3
Mastering Maven 2.0 In 1 Hour V1.3
 
An introduction to Maven
An introduction to MavenAn introduction to Maven
An introduction to Maven
 
Continuous integration and delivery for java based web applications
Continuous integration and delivery for java based web applicationsContinuous integration and delivery for java based web applications
Continuous integration and delivery for java based web applications
 
Continuous Delivery
Continuous DeliveryContinuous Delivery
Continuous Delivery
 

Similaire à Build Automation using Maven

Similaire à Build Automation using Maven (20)

Maven
MavenMaven
Maven
 
Introduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS worldIntroduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS world
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
 
Apache maven, a software project management tool
Apache maven, a software project management toolApache maven, a software project management tool
Apache maven, a software project management tool
 
Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 features
 
Maven basics
Maven basicsMaven basics
Maven basics
 
Manen Ant SVN
Manen Ant SVNManen Ant SVN
Manen Ant SVN
 
Maven
MavenMaven
Maven
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
 
Open Source tools overview
Open Source tools overviewOpen Source tools overview
Open Source tools overview
 
Apache ANT vs Apache Maven
Apache ANT vs Apache MavenApache ANT vs Apache Maven
Apache ANT vs Apache Maven
 
Maven in mulesoft
Maven in mulesoftMaven in mulesoft
Maven in mulesoft
 
Maven
MavenMaven
Maven
 
Ci jenkins maven svn
Ci jenkins maven svnCi jenkins maven svn
Ci jenkins maven svn
 
Maven
MavenMaven
Maven
 
Mavennotes.pdf
Mavennotes.pdfMavennotes.pdf
Mavennotes.pdf
 
A-Z_Maven.pdf
A-Z_Maven.pdfA-Z_Maven.pdf
A-Z_Maven.pdf
 
Session 2
Session 2Session 2
Session 2
 
Session 2
Session 2Session 2
Session 2
 
Exploring Maven SVN GIT
Exploring Maven SVN GITExploring Maven SVN GIT
Exploring Maven SVN GIT
 

Plus de Ankit Gubrani

Circuit breaker pattern
Circuit breaker patternCircuit breaker pattern
Circuit breaker patternAnkit Gubrani
 
AEM integration with Apache Mahout
AEM integration with Apache MahoutAEM integration with Apache Mahout
AEM integration with Apache MahoutAnkit Gubrani
 
Content personalization in AEM
Content personalization in AEMContent personalization in AEM
Content personalization in AEMAnkit Gubrani
 
Integrating Apache Wookie with AEM || AEM-Wookie Connector Tool
Integrating Apache Wookie with AEM || AEM-Wookie Connector ToolIntegrating Apache Wookie with AEM || AEM-Wookie Connector Tool
Integrating Apache Wookie with AEM || AEM-Wookie Connector ToolAnkit Gubrani
 
Introduction to Sightly
Introduction to SightlyIntroduction to Sightly
Introduction to SightlyAnkit Gubrani
 
AEM Client Context Customisation
AEM Client Context CustomisationAEM Client Context Customisation
AEM Client Context CustomisationAnkit Gubrani
 

Plus de Ankit Gubrani (8)

Sling pipes
Sling pipesSling pipes
Sling pipes
 
Circuit breaker pattern
Circuit breaker patternCircuit breaker pattern
Circuit breaker pattern
 
Sling models
Sling modelsSling models
Sling models
 
AEM integration with Apache Mahout
AEM integration with Apache MahoutAEM integration with Apache Mahout
AEM integration with Apache Mahout
 
Content personalization in AEM
Content personalization in AEMContent personalization in AEM
Content personalization in AEM
 
Integrating Apache Wookie with AEM || AEM-Wookie Connector Tool
Integrating Apache Wookie with AEM || AEM-Wookie Connector ToolIntegrating Apache Wookie with AEM || AEM-Wookie Connector Tool
Integrating Apache Wookie with AEM || AEM-Wookie Connector Tool
 
Introduction to Sightly
Introduction to SightlyIntroduction to Sightly
Introduction to Sightly
 
AEM Client Context Customisation
AEM Client Context CustomisationAEM Client Context Customisation
AEM Client Context Customisation
 

Dernier

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durbanmasabamasaba
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
Generic or specific? Making sensible software design decisions
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
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...masabamasaba
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 

Dernier (20)

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 

Build Automation using Maven

  • 1. Build Automation With maven (By Ankit Gubrani)
  • 2. Agenda q What is maven? q Why maven? q Maven Installation. q How maven works. q The build Lifecycle. q Basics of POM, Profiles, Repositories. q Maven Plugins. q Maven Dependency. q Creating custom maven Plugin.
  • 5. Ok but before that ! What is a build tool?
  • 6. Build Tool q A build tool is a programming utility that is used when building a new version of a program. q Build tools are tools to manage and organise your builds.
  • 7.
  • 8. Now that you know What Build Tool is. Here is Maven -
  • 9. Maven q Maven is a popular open source build tool used primarily for Java projects. It was designed to make build process easier task. q Apart from being a build tool Maven can also manage reporting and documentation from a central piece of information. q It is based on the concept of a project object model (POM). q Maven is more than just a "build tool" rather is a project management tool.
  • 10. Maven provides developers ways to manage following: q Builds q Documentation q Reporting q Dependencies q SCMs q Releases q Distribution q Mailing list
  • 11. Why Maven if we have other Build tools available ???
  • 12. Comparison Here are some of the benefits of using Maven over any other build (Ant, make etc) : q Standardized project layout. (Convention over configuration unlike ANT) q Automatic dependency handling.(Ant can't do this unassisted) q Large Existing repository. q Reusability ( through Maven Plugins).
  • 14. Installation q Maven is a Java tool, so you must have Java installed in order to proceed. q Follow the instructions on the link for intallation : http://maven.apache.org/download.cgi#Installatio n q Once installation is done type the following command in a terminal or in a command prompt: mvn –version It should print out your installed version of Maven
  • 15.
  • 17. Lifecycle q Build Lifecycle is a well defined sequence of phases which define the order in which the goals are to be executed. Here phase represents a stage in life cycle. q When Maven starts building a project, it steps through a defined sequence of phases and executes goals which are registered with each phase. Maven has following three standard lifecycles: q Clean q default(or build) q Site
  • 18. q A Build Lifecycle is Made Up of Phases. q A Build Phase is Made Up of Plugin Goals. q A Plugin Goal represents a specific task (finer than a build phase) which contributes to the building and managing of a project.
  • 20. POM
  • 21. lProject Object Model q POM stands for Project Object Model. It is fundamental Unit of work in Maven. q It is an XML file. It always resides in the base directory of the project as pom.xml. q The POM contains information about the project and various configuration detail used by Maven to build the project.
  • 22. lSome of the configuration that can be specified in the POM are following: q project dependencies q plugins q goals q build profiles q project version q developers q mailing list
  • 24. q A maven repository is a directory of packaged JAR file with pom.xml file. Maven searches for dependencies in the repositories. There are 3 types of maven repostory : § Local Repository § Central Repository § Remote Repository q Maven searches for the dependencies in the following order: q Local repository then Central repository then Remote repository.
  • 25. q Local Repository :- § Maven local repository is located in your local system. It is created by the maven when you run any maven command. § By default, maven local repository is %USER_HOME%/.m2 directory. For example: C:UsersSSS IT.m2. q Central Repository :- § Maven central repository is located on the web. It has been created by the apache maven community itself. § The path of central repository is: http://repo1.maven.org/maven2 .
  • 26. q Remote Repository :- § Maven remote repository is located on the web. Most of libraries can be missing from the central repository such as JBoss library etc, so we need to define remote repository in pom.xml file.
  • 28. q A Build profile is a set of configuration values which can be used to set or override default values of Maven build. Using a build profile, you can customize build for different environments such as Production v/s Development environments. q Build profiles are majorly of three types : § Per Project :- Defined in the project POM file, pom.xml § Per User :- Defined in Maven settings xml file (%USER_HOME%/.m2/settings.xml) § Global :- Defined in Maven global settings xml file (%M2_HOME%/conf/settings.xml)
  • 30. q Plugins are the central feature of Maven that allow for the reuse of common build logic across multiple projects. q Maven is actually a plugin execution framework where every task is actually done by plugins. q A plugin generally provides a set of goals and which can be executed using following syntax: ü mvn [plugin-name]:[goal-name] q There are plugins for almost every task in maven like plugins are used to: create jar files, create war files, compile code, unit test code, create project documentation, and on and on.
  • 31. q Maven provides following two types of Plugins: 1)Build plugins:- They execute during the build and should be configured in the <build/> element of pom.xml . 2)Reporting plugins:-They execute during the site generation and they should be configured in the <reporting/> element of the pom.xml .
  • 33. lAn archetype is defined as an original pattern or model from which all other things of the same kind are made. lMaven provides users,a very large list of different types of project templates using concept of Archetype. Maven helps users to quickly start a new java project using following command : mvn archetype:generate lArchetype is a Maven plugin whose task is to create a project structure as per its template. Archetype Plugin allows the user to create a Maven project from an existing template called an archetype. Archetype
  • 34. Now that you know basics of maven, Let's create a maven project
  • 35. q For creating any project maven provides templates(Archetype), using which one can create by selecting any one archetype from available archetypes. q To start a new Maven project, use the Maven Archetype plugin from the command line. Run the following command :- § mvn archetype:generate -DarchetypeGroupId=[Group Id] - DarchetypeArtifactId= [Artifact ID] q You can search for all archetypes provided by maven at there central repository (http://search.maven.org/) and all other 3rd party archetypes at any remote repository like - http://mvnrepository.com
  • 36. Demo
  • 38. q SNAPSHOT is a special version that indicates a current development copy. q Unlike regular versions, Maven checks for a new SNAPSHOT version in a remote repository for every build. q Snapshot vs Version :- q In case of Version, if Maven once downloaded the mentioned version say data-service:1.0, it will never try to download a newer 1.0 available in repository. To download the updated code, artifact version is be upgraded to 1.1. q In case of SNAPSHOT, Maven will automatically fetch the latest SNAPSHOT (data-service:1.0-SNAPSHOT) everytime app-ui team build their project.
  • 39. Hey did you notice ??? What we did till now automated the build process. And this is called Build Automation using Maven
  • 41. q Team communication is an essential part of any project. And wasting time looking for technical project information can be costly and frustrating. Clearly, any IT project will benefit from having its own dedicated technical Website. q That's where the Maven site generator steps in. With little effort, you can have a professional-quality, low maintenance project Website up and running in no time. q Documentation is generated by running § mvn site
  • 43.
  • 44. lAbout Me .about-me{ name: Ankit Gubrani !Sr. AEM Developer; email-id: ankit.gubrani@codebrains.co.in; LinkedIn: in.linkedin.com/in/ankitgubrani; twitter: @ankitgubrani90; blog: codebrains.blogspot.in; website : codebrains.co.in; }
  • 45. Thank You Please contact me at : ankit.gubrani@codebrains.co.in