Sunteți pe pagina 1din 16

Synopsis

Introduction

Why Maven?

Prerequisites

Project Structure

POM

Phases

Dependency Management

Project Structure

Plugins

Inheritance

Multi Module Support



Introduction

Software management and comprehension tool

!ased on Project O"ject Model #POM$ % manage project "uild& reporting& and
documentation from a central piece of information

Why Maven?

'asy !uild Process

(niform !uild System

)uality Project Information

*uidelines for !est Practices Development

+isi"ility

,e usa"ility

Maintaina"ility

POM

A fundamental unit of work in Maven

An XML file that contains information about project and configuration details
used by Maven to build the project

Already built into the Maven engine

Contains:
-ame and +ersion
.rtifact /ype
Source 0ode 1ocations
Dependencies
Plug%ins
Profiles #.lternate "uild configurations$



Dependency Management

/he dependency management model for projects whose components


developed "y different project teams

Supports continuous independent development and refinement of all dependent


Modules
Maven local:

Directory on your dis2#located at Homeirectory3m43repository$

.cts as a high%performance local cache& storing artifacts downloaded


Remote repositories:

.ccessed over the networ2 5ou can maintain a list of remote repositories to
use in your settings6ml configuration file

Dependencies are specified in 7dependencies8 elements within a pom6ml file

Project dependencies are stored on repository servers #simply called


repositories in


Eg:
7dependencies8
7dependency8
7groupId8junit73groupId8
7artifactId8junit73artifactId8
7version89:;73version8
73dependency8
73dependencies8
<unit for unit testing

Project Structure

Project Structure#cont$
Target: Default wor2 directory
src: .ll project source files go in this directory
src/main: .ll sources that go into primary artifact
src/test: .ll sources contri"uting to testing project
src/main/java: .ll java source files
src/main/webapp: .ll we" source files
src/main/resources: .ll non compiled source files
src/test/java: .ll java test source files
src/test/resources: .ll non compiled test source files

*roupID= .r"itrary project grouping identifier

.rtfiactId= .r"itrary name of project

+ersion= +ersion of project

>ormat = ?Major@?Minor@?Maintanence@

AS-.PSBO/ A Identify in development

*.+ Synta6=
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>.0.0<!modelVersion>
<"rti#"ct$d>m"ven-tr"ining<!"rti#"ct$d>
<gro%p$d>org.lds.tr"ining<!gro%p$d>
<version>1.0<!version>
<packaging>jar</packaging>
<!project>
Project Structure#cont$

Pac2aging

!uild type identified using the Cpac2agingD element

'6ample pac2aging types=


pom& jar& war& ear& custom
Default is jar
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>.0.0<!modelVersion>
<"rti#"ct$d>m"ven-tr"ining<!"rti#"ct$d>
<gro%p$d>org.lds.tr"ining<!gro%p$d>
<version>1.0<!version>
<packaging>jar</packaging>
<!project>

7dependencies8
7dependency8
7groupId8comi"mdevwor2s73grou
pId8
7artifactId8OpsImp73artifactId8
7version8;E%
S-.PSBO/73version8
73dependency8
73dependencies8
SNAPSHOT
S-.PSBO/ tells Maven F under development % fetch the latest copy of the
artifact availa"le

Plugins
When you use Maven&wor2 is performed e6clusively via plug%ins

Multi module support

Maven has ;
st
class multi%module support

'ach maven project creates ; primary artifact

. parent pom is used to group modules


7project8

7pac2aging8pom73pac2aging8
mo!ules"
mo!ule"maven#training/mo!ule"
mo!ule"maven#training#web/mo!ule"
/mo!ules"
73project8

S-ar putea să vă placă și