SlideShare ist ein Scribd-Unternehmen logo
1 von 45
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
 
Jenkins
JenkinsJenkins
Jenkins
 
Introduction to devops
Introduction to devopsIntroduction to devops
Introduction to devops
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Understanding DevOps
Understanding DevOpsUnderstanding DevOps
Understanding DevOps
 
Jenkins tutorial
Jenkins tutorialJenkins tutorial
Jenkins tutorial
 
Jenkins
JenkinsJenkins
Jenkins
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
 
Azure Pipelines
Azure PipelinesAzure Pipelines
Azure Pipelines
 
Maven 3 Overview
Maven 3  OverviewMaven 3  Overview
Maven 3 Overview
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
Apache maven 2 overview
Apache maven 2 overviewApache maven 2 overview
Apache maven 2 overview
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with Maven
 
Virtual Container - Docker
Virtual Container - Docker Virtual Container - Docker
Virtual Container - Docker
 
DevOps - A Gentle Introduction
DevOps - A Gentle IntroductionDevOps - A Gentle Introduction
DevOps - A Gentle Introduction
 
Maven
MavenMaven
Maven
 
DevOps
DevOps DevOps
DevOps
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
Spring boot
Spring bootSpring boot
Spring boot
 

Andere mochten auch

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
 
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
 
Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To HibernateAmit Himani
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVCDzmitry Naskou
 

Andere mochten auch (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
 
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
 
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
 
Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To Hibernate
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
 

Ähnlich wie Build Automation using Maven

Ähnlich wie 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
 
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
 
Apache_Maven
Apache_MavenApache_Maven
Apache_Maven
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
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
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
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
 
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
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
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
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 

Kürzlich hochgeladen (20)

Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
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-...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
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
 
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 ...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
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
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 

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