SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Maven

IDEALINVENT Technologies
Introduction
Maven is a software project management and automation tool
used primarily for Java projects.
Based on the concept of a project object model (POM), Maven
can manage a project's build, reporting and documentation from
a central piece of information.
Maven uses an XML file to describe the software project being
built,

its

dependencies

on

other

external

modules

and

components, the build order, directories, and required plug-ins.
Convention and
configuration


When a Maven project is created, Maven creates default project

structure.


Developer is only required to place files accordingly and he/she

need not to define any configuration in pom.xml.
As an example, following table shows the default values for project
source code files, resource files and other configurations.
Assuming, ${basedir} denotes the project location:
source code

: ${basedir}/src/main/java

Resources

: ${basedir}/src/main/resources

Tests

: ${basedir}/src/test

Complied
byte code

: ${basedir}/target/classes

distributable JAR : ${basedir}/target
Maven POM
• POM stands for Project Object Model.
• It is fundamental Unit of Work in Maven. It is an XML file.
• A file with this name has to exist in the root of every maven
project.
• In this file are defined the plugins to use,paths and settings to
override the maven defaults of your project.
• Each POM inherits automatically from a superPOM,a virtual
POM embedded in the Maven core.
Some of the configuration that can be specified in the POM are
following:


project dependencies



plugins



goals



build profiles



project version



developers



mailing list
The pom describes the project and its dependencies.Each with
3 "coordinates":
-Group ID
:This is an Id of project's group. This is
generally unique amongst an organization or a project. For
example, a banking group com.company.bank has all bank
related projects.
-Artifact ID (common) :This is generally name of the project.
-Version (1.0)

:This is the version of the project.


Maven is declarative.



Specify the jars used,where they come from,and what

release,and maven will manage the files without

explicit

coding.




Even if the jar filename has no version,Maven keeps track.
While executing a task or goal, Maven looks for the POM in the

current directory. It reads the POM, gets the needed configuration
information, then executes the goal.
Maven Repositories
A repository is a place i.e. directory where all the project jars,
library jar, plugins or any other project specific artifacts are stored
and can be used by Maven easily.
Maven repository are of three types
• local
• central
• remote
Local Repository
• It gets created when you run any maven command for the first
time.
• In simple, when you build a Maven project, all dependency files
will be stored in your Maven local repository.
•

When you run a Maven build, then Maven automatically

downloads all the dependency jars into the local repository.
•It helps to avoid references to dependencies stored on remote
machine every time a project is build.
•

Maven local repository by default get created by Maven in

%USER_HOME% directory. To override the default location,
mention another path in Maven settings.xml file available at
%M2_HOME%conf directory.
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings1.0.0.xsd">
<localRepository>C:/MyLocalRepository</localRepository>
</settings>
Central Repository
Maven central repository is repository provided by Maven
community. It contains a large number of commonly used libraries.
• When Maven does not find any dependency in local repository, it
starts searching in central repository using following URL:
http://repo1.maven.org/maven2/
Key concepts of Central repository
•

This repository is managed by Maven community.

•

It is not required to be configured.

•

It requires internet access to be searched.
Remote Repository
It is developer's own custom repository containing required libraries or other
project jars.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.companyname.projectgroup</groupId>
<artifactId>project</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>com.companyname.common-lib</groupId>
<artifactId>common-lib</artifactId>
<version>1.0.0</version>
</dependency>
<dependencies>
<repositories>
<repository>
<id>companyname.lib1</id>
<url>http://download.companyname.org/maven2/lib1</url>
</repository>
<repository>
<id>companyname.lib2</id>
<url>http://download.companyname.org/maven2/lib2</url>
</repository>
</repositories>
</project>
Example for Dependency
Consider a team is developing a project bus-core-api on which two other
projects app-web-ui and app-desktop-ui are dependent.

bus-core-api project
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>bus-core-api</groupId>
<artifactId>bus-core-api</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
</project>
app-web-ui project is using 1.0-SNAPSHOT of bus-core-api project
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>app-web-ui</groupId>
<artifactId>app-web-ui</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>bus-core-api</groupId>
<artifactId>bus-core-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
app-desktop-ui project is using 1.0-SNAPSHOT of bus-core-api
project
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>app-desktop-ui</groupId>
<artifactId>app-desktop-ui</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>bus-core-api</groupId>
<artifactId>bus-core-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Snapshot vs Version


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, dataservice version is be upgraded to 1.1.


In case of SNAPSHOT, Maven will automatically fetch the latest

SNAPSHOT (data-service:1.0-SNAPSHOT) everytime app-ui team
build their project.
Ant Vs Maven
A Simple Ant build.xml file.
<project name="my-project" default="dist" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src/main/java"/>
<property name="build" location="target/classes"/>
<property name="dist" location="target"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
A Sample Maven pom.xml.
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.sonatype.mavenbook</groupId>
<artifactId>my-project</artifactId>
<version>1.0</version>
</project>



You have to tell Ant exactly where your source is, where you

want the resulting bytecode to be stored, and how to package
this all into a JAR file.


Running mvn install from the command line will process
resources, compile source, execute unit tests, create a JAR, and
install the JAR in a local repository for reuse in other projects.



In Maven, to create a JAR file from some Java source, all you

need to do is
create a simple pom.xml, place your source code in $
{basedir}/src/main/java and then run mvn install from the
command line.
Advantages of Using Maven
Making the build process easy and provide uniform
build environment.




Reusable plugins, repositories.



Dependencies are downloaded automatically.



Standardized, very consistent naming.

Maven forces you to have a standard directory
structure

Thank you

Weitere ähnliche Inhalte

Was ist angesagt?

SCWCD : Servlet web applications : CHAP 3
SCWCD : Servlet web applications : CHAP 3SCWCD : Servlet web applications : CHAP 3
SCWCD : Servlet web applications : CHAP 3Ben Abdallah Helmi
 
Mule esb
Mule esbMule esb
Mule esbKhan625
 
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...탑크리에듀(구로디지털단지역3번출구 2분거리)
 
Zend Framework 2 - presentation
Zend Framework 2 - presentationZend Framework 2 - presentation
Zend Framework 2 - presentationyamcsha
 
Java, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorialJava, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorialRaghavan Mohan
 
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010Arun Gupta
 
Spring Web Views
Spring Web ViewsSpring Web Views
Spring Web ViewsEmprovise
 
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slidesSpring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slidesHitesh-Java
 
JavaOne India 2011 - Servlets 3.0
JavaOne India 2011 - Servlets 3.0JavaOne India 2011 - Servlets 3.0
JavaOne India 2011 - Servlets 3.0Arun Gupta
 
Lecture 5 JSTL, custom tags, maven
Lecture 5   JSTL, custom tags, mavenLecture 5   JSTL, custom tags, maven
Lecture 5 JSTL, custom tags, mavenFahad Golra
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionPhilip Norton
 
Introduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesIntroduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesGerald Villorente
 
Getting Into Drupal 8 Configuration
Getting Into Drupal 8 ConfigurationGetting Into Drupal 8 Configuration
Getting Into Drupal 8 ConfigurationPhilip Norton
 

Was ist angesagt? (20)

SCWCD : Servlet web applications : CHAP 3
SCWCD : Servlet web applications : CHAP 3SCWCD : Servlet web applications : CHAP 3
SCWCD : Servlet web applications : CHAP 3
 
Mule esb
Mule esbMule esb
Mule esb
 
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
 
Algotitmo Moinho
Algotitmo MoinhoAlgotitmo Moinho
Algotitmo Moinho
 
Zend Framework 2 - presentation
Zend Framework 2 - presentationZend Framework 2 - presentation
Zend Framework 2 - presentation
 
Java, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorialJava, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorial
 
Jdbc
JdbcJdbc
Jdbc
 
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
 
Apache Maven basics
Apache Maven basicsApache Maven basics
Apache Maven basics
 
Laravel 5
Laravel 5Laravel 5
Laravel 5
 
Spring Web Views
Spring Web ViewsSpring Web Views
Spring Web Views
 
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slidesSpring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
Spring - Part 2 - Autowiring, Annotations, Java based Configuration - slides
 
JavaOne India 2011 - Servlets 3.0
JavaOne India 2011 - Servlets 3.0JavaOne India 2011 - Servlets 3.0
JavaOne India 2011 - Servlets 3.0
 
Lecture 5 JSTL, custom tags, maven
Lecture 5   JSTL, custom tags, mavenLecture 5   JSTL, custom tags, maven
Lecture 5 JSTL, custom tags, maven
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency Injection
 
Introduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesIntroduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, Terminologies
 
Getting Into Drupal 8 Configuration
Getting Into Drupal 8 ConfigurationGetting Into Drupal 8 Configuration
Getting Into Drupal 8 Configuration
 
Tomcat + other things
Tomcat + other thingsTomcat + other things
Tomcat + other things
 
Pom
PomPom
Pom
 
Drupal 8 Services
Drupal 8 ServicesDrupal 8 Services
Drupal 8 Services
 

Andere mochten auch

SOFTVISION - prezentare companie 2015
SOFTVISION - prezentare companie 2015SOFTVISION - prezentare companie 2015
SOFTVISION - prezentare companie 2015Simona Mihaela Cocis
 
Hotel Management Software
Hotel Management SoftwareHotel Management Software
Hotel Management SoftwareQuoc Nguyen
 
5 most important sales metrics 2017
5 most important sales metrics 20175 most important sales metrics 2017
5 most important sales metrics 2017Teamgate CRM
 
Customer Relationship Management (CRM)
Customer Relationship Management (CRM)Customer Relationship Management (CRM)
Customer Relationship Management (CRM)Rahul Gupta
 
Internship Presentation - Vitruvian Technologies
Internship Presentation - Vitruvian TechnologiesInternship Presentation - Vitruvian Technologies
Internship Presentation - Vitruvian TechnologiesIshan Parekh
 
Activitats tema 3 socials
Activitats tema 3 socialsActivitats tema 3 socials
Activitats tema 3 socialsbisquertmarcos
 
Facts about Interim Management Jobs
Facts about Interim Management JobsFacts about Interim Management Jobs
Facts about Interim Management JobsCrish Mart
 
Hotels in goa, goa holiday homes
Hotels in goa, goa holiday homesHotels in goa, goa holiday homes
Hotels in goa, goa holiday homesCrish Mart
 
Film Studio Hire, Film Location
Film Studio Hire, Film LocationFilm Studio Hire, Film Location
Film Studio Hire, Film LocationCrish Mart
 

Andere mochten auch (14)

SlideShare 101
SlideShare 101SlideShare 101
SlideShare 101
 
Product Guide
Product GuideProduct Guide
Product Guide
 
SOFTVISION - prezentare companie 2015
SOFTVISION - prezentare companie 2015SOFTVISION - prezentare companie 2015
SOFTVISION - prezentare companie 2015
 
Research Guide
Research GuideResearch Guide
Research Guide
 
Company profile
Company profileCompany profile
Company profile
 
Hotel Management Software
Hotel Management SoftwareHotel Management Software
Hotel Management Software
 
5 most important sales metrics 2017
5 most important sales metrics 20175 most important sales metrics 2017
5 most important sales metrics 2017
 
Customer Relationship Management (CRM)
Customer Relationship Management (CRM)Customer Relationship Management (CRM)
Customer Relationship Management (CRM)
 
Internship Presentation - Vitruvian Technologies
Internship Presentation - Vitruvian TechnologiesInternship Presentation - Vitruvian Technologies
Internship Presentation - Vitruvian Technologies
 
Activitats tema 3 socials
Activitats tema 3 socialsActivitats tema 3 socials
Activitats tema 3 socials
 
The good physician- Paul Drago, MD
The good physician- Paul Drago, MDThe good physician- Paul Drago, MD
The good physician- Paul Drago, MD
 
Facts about Interim Management Jobs
Facts about Interim Management JobsFacts about Interim Management Jobs
Facts about Interim Management Jobs
 
Hotels in goa, goa holiday homes
Hotels in goa, goa holiday homesHotels in goa, goa holiday homes
Hotels in goa, goa holiday homes
 
Film Studio Hire, Film Location
Film Studio Hire, Film LocationFilm Studio Hire, Film Location
Film Studio Hire, Film Location
 

Ähnlich wie Mavenppt (20)

Maven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafeMaven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafe
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with Maven
 
Maven
MavenMaven
Maven
 
Maven
MavenMaven
Maven
 
Maven
MavenMaven
Maven
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
 
Maven introduction in Mule
Maven introduction in MuleMaven introduction in Mule
Maven introduction in Mule
 
Introduction to maven
Introduction to mavenIntroduction to maven
Introduction to maven
 
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
MavenMaven
Maven
 
Liferay maven sdk
Liferay maven sdkLiferay maven sdk
Liferay maven sdk
 
Maven basics
Maven basicsMaven basics
Maven basics
 
Maven with Flex
Maven with FlexMaven with Flex
Maven with Flex
 
Maven with Flex
Maven with FlexMaven with Flex
Maven with Flex
 
Maven
MavenMaven
Maven
 
A-Z_Maven.pdf
A-Z_Maven.pdfA-Z_Maven.pdf
A-Z_Maven.pdf
 
Note - Apache Maven Intro
Note - Apache Maven IntroNote - Apache Maven Intro
Note - Apache Maven Intro
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
 
Maven
MavenMaven
Maven
 
Maven
MavenMaven
Maven
 

Kürzlich hochgeladen

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 

Kürzlich hochgeladen (20)

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 

Mavenppt

  • 2. Introduction Maven is a software project management and automation tool used primarily for Java projects. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information. Maven uses an XML file to describe the software project being built, its dependencies on other external modules and components, the build order, directories, and required plug-ins.
  • 3. Convention and configuration  When a Maven project is created, Maven creates default project structure.  Developer is only required to place files accordingly and he/she need not to define any configuration in pom.xml.
  • 4. As an example, following table shows the default values for project source code files, resource files and other configurations. Assuming, ${basedir} denotes the project location: source code : ${basedir}/src/main/java Resources : ${basedir}/src/main/resources Tests : ${basedir}/src/test Complied byte code : ${basedir}/target/classes distributable JAR : ${basedir}/target
  • 5. Maven POM • POM stands for Project Object Model. • It is fundamental Unit of Work in Maven. It is an XML file. • A file with this name has to exist in the root of every maven project. • In this file are defined the plugins to use,paths and settings to override the maven defaults of your project. • Each POM inherits automatically from a superPOM,a virtual POM embedded in the Maven core.
  • 6. Some of the configuration that can be specified in the POM are following:  project dependencies  plugins  goals  build profiles  project version  developers  mailing list
  • 7. The pom describes the project and its dependencies.Each with 3 "coordinates": -Group ID :This is an Id of project's group. This is generally unique amongst an organization or a project. For example, a banking group com.company.bank has all bank related projects. -Artifact ID (common) :This is generally name of the project. -Version (1.0) :This is the version of the project.
  • 8.  Maven is declarative.  Specify the jars used,where they come from,and what release,and maven will manage the files without explicit coding.   Even if the jar filename has no version,Maven keeps track. While executing a task or goal, Maven looks for the POM in the current directory. It reads the POM, gets the needed configuration information, then executes the goal.
  • 9. Maven Repositories A repository is a place i.e. directory where all the project jars, library jar, plugins or any other project specific artifacts are stored and can be used by Maven easily. Maven repository are of three types • local • central • remote
  • 10. Local Repository • It gets created when you run any maven command for the first time. • In simple, when you build a Maven project, all dependency files will be stored in your Maven local repository. • When you run a Maven build, then Maven automatically downloads all the dependency jars into the local repository. •It helps to avoid references to dependencies stored on remote machine every time a project is build.
  • 11. • Maven local repository by default get created by Maven in %USER_HOME% directory. To override the default location, mention another path in Maven settings.xml file available at %M2_HOME%conf directory.
  • 13. Central Repository Maven central repository is repository provided by Maven community. It contains a large number of commonly used libraries. • When Maven does not find any dependency in local repository, it starts searching in central repository using following URL: http://repo1.maven.org/maven2/ Key concepts of Central repository • This repository is managed by Maven community. • It is not required to be configured. • It requires internet access to be searched.
  • 14. Remote Repository It is developer's own custom repository containing required libraries or other project jars. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.companyname.projectgroup</groupId> <artifactId>project</artifactId> <version>1.0</version> <dependencies> <dependency> <groupId>com.companyname.common-lib</groupId> <artifactId>common-lib</artifactId> <version>1.0.0</version> </dependency> <dependencies> <repositories> <repository> <id>companyname.lib1</id> <url>http://download.companyname.org/maven2/lib1</url> </repository> <repository> <id>companyname.lib2</id> <url>http://download.companyname.org/maven2/lib2</url> </repository> </repositories> </project>
  • 15. Example for Dependency Consider a team is developing a project bus-core-api on which two other projects app-web-ui and app-desktop-ui are dependent. bus-core-api project <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>bus-core-api</groupId> <artifactId>bus-core-api</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> </project>
  • 16. app-web-ui project is using 1.0-SNAPSHOT of bus-core-api project <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>app-web-ui</groupId> <artifactId>app-web-ui</artifactId> <version>1.0</version> <packaging>jar</packaging> <dependencies> <dependency> <groupId>bus-core-api</groupId> <artifactId>bus-core-api</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies> </project>
  • 17. app-desktop-ui project is using 1.0-SNAPSHOT of bus-core-api project <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>app-desktop-ui</groupId> <artifactId>app-desktop-ui</artifactId> <version>1.0</version> <packaging>jar</packaging> <dependencies> <dependency> <groupId>bus-core-api</groupId> <artifactId>bus-core-api</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies> </project>
  • 18. Snapshot vs Version  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, dataservice version is be upgraded to 1.1.  In case of SNAPSHOT, Maven will automatically fetch the latest SNAPSHOT (data-service:1.0-SNAPSHOT) everytime app-ui team build their project.
  • 19. Ant Vs Maven A Simple Ant build.xml file. <project name="my-project" default="dist" basedir="."> <description> simple example build file </description> <!-- set global properties for this build --> <property name="src" location="src/main/java"/> <property name="build" location="target/classes"/> <property name="dist" location="target"/> <target name="init"> <!-- Create the time stamp --> <tstamp/> <!-- Create the build directory structure used by compile --> <mkdir dir="${build}"/> </target> <target name="compile" depends="init" description="compile the source " > <!-- Compile the java code from ${src} into ${build} --> <javac srcdir="${src}" destdir="${build}"/> </target> <target name="dist" depends="compile" description="generate the distribution" > <!-- Create the distribution directory --> <mkdir dir="${dist}/lib"/> <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file --> <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/> </target> <target name="clean" description="clean up" > <!-- Delete the ${build} and ${dist} directory trees --> <delete dir="${build}"/> <delete dir="${dist}"/> </target> </project>
  • 20. A Sample Maven pom.xml. <project> <modelVersion>4.0.0</modelVersion> <groupId>org.sonatype.mavenbook</groupId> <artifactId>my-project</artifactId> <version>1.0</version> </project>  You have to tell Ant exactly where your source is, where you want the resulting bytecode to be stored, and how to package this all into a JAR file.
  • 21.  Running mvn install from the command line will process resources, compile source, execute unit tests, create a JAR, and install the JAR in a local repository for reuse in other projects.  In Maven, to create a JAR file from some Java source, all you need to do is create a simple pom.xml, place your source code in $ {basedir}/src/main/java and then run mvn install from the command line.
  • 22. Advantages of Using Maven Making the build process easy and provide uniform build environment.   Reusable plugins, repositories.  Dependencies are downloaded automatically.  Standardized, very consistent naming. Maven forces you to have a standard directory structure 