SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
November 14, 2016 1
MAVEN
November 14, 2016 2
• Maven is a project management and comprehension tool.
• Maven projects is powerful tool for Java projects
• What is Maven ?
Maven is a software management and comprehension tool based on
the concept of Project Object Model (POM) which can manage project
build, reporting, and documentation from a central piece of
information.
• What is POM ?
As a fundamental unit of work in Maven, POM is an XML file that
contains information about project and configuration details used by
Maven to build the project.
Overview ?
November 14, 2016 3
• Maven is more than just Build tool.
• Characteristics
– Visibility
– Reusability
– Maintainability
– Comprehensibility “Accumulator of knowledge”
• Objectives
– Easy build process
– Uniform build system
– Quality Project Information
– Guidelines for Best Practices Development
Objectives and Characteristics ?
November 14, 2016 4
1. One level above ANT
2. Higher level of reusability between builds
3. Faster turn around time to set up a powerful build
4. Project website generation
5. Less maintenance
6. Greater momentum
7. Repository management
8. Automatic downloads
Maven website
http://maven.apache.org
Comparision with ANT
ANT MAVEN
Target
build.xml
Goal
pom.xml
November 14, 2016 5
• Download MAVEN http://maven.apache.org/download.cgi
and unzip Maven.
• Set the M2_HOME environment variable to point to the directory you unzipped
Maven to.
• Set the M2 environment variable to point to M2_HOME/bin (%M2_HOME%bin on
Windows, $M2_HOME/bin on unix).
• Add M2 to the PATH environment variable (%M2% on Windows, $M2 on unix).
• Open a command prompt and type 'mvn' (without quotes) and press enter.
Installation of MAVEN
November 14, 2016 6
• Apache project
– Sponsored by sonatype
• History
– Maven 1 (2003)
• Very Ugly
• Used in Stack 1
– Maven 2 (2005)
• Complete rewrite
• Not backwards Compatible
• Used in Stack 2.0,2.1,2.2,3.0
– Maven 3 (2010)
• Same as Maven 2 but more stable
• Used in Stack 2.3, 3.1,3.2.1
History
November 14, 2016 7
• Maven Homepage
– http://maven.apache.org
• Reference Documentation for Maven
• Reference Documentation for core Plugins
• Sonatype Resources
– http://www.sonatype.com/resource-center.html
• Free Books
• Videos
Maven learning Courses
November 14, 2016 8
• Stands for Project Object Model
• Describes a project
– Name and Version
– Artifact Type
– Source Code Locations
– Dependencies
– Plugins
– Profiles (Alternate build configurations)
• Uses XML by Default
– Not the way Ant uses XML
Maven POM
November 14, 2016 9
Maven POM
November 14, 2016 10
Project Name
•Maven uniquely identifies a project using:
–groupID: Arbitrary project grouping identifier (no spaces or colons)
•Usually loosely based on Java package
–artfiactId: Arbitrary name of project (no spaces or colons)
–version: Version of project
•Format {Major}.{Minor}.{Maintanence}
•Add ‘-SNAPSHOT ‘ to identify in development
•GAV Syntax: groupId:artifactId:version
<?xml version="1.0" encoding="UTF-8"?>
<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>
<artifactId>maven-training</artifactId>
<groupId>org.learning</groupId>
<version>1.0</version>
</project>
November 14, 2016 11
Packaging
•Build type identified using the “packaging” element
•Tells Maven how to build the project
•Example packaging types:
–pom, jar, war, ear, custom
–Default is jar
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>maven-training</artifactId>
<groupId>org.learning</groupId>
<version>1.0</version>
<packaging>jar</packaging>
</project>
November 14, 2016 12
Project Inheritance
• Pom files can inherit configuration
–groupId, version
–Project Config
–Dependencies
–Plugin configuration
–Etc.
<?xml version="1.0" encoding="UTF-8"?>
<project>
<parent>
<artifactId>maven-training-parent</artifactId>
<groupId>org.learning.training</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>maven-training</artifactId>
<groupId>org.learning.training</groupId>
<version>1.0</version>
<packaging>jar</packaging>
</project>
November 14, 2016 13
Multi Module Project
• Pom Maven has 1st class multi-module support
• Each maven project creates 1 primary artifact
• A parent pom is used to group modules
<project>
...
<packaging>pom</packaging>
<modules>
<module>maven-training</module>
<module>maven-training-web</module>
</modules>
</project>
November 14, 2016 14
Maven Conventions
•Maven is opinionated about project structure
•target: Default work directory
•src: All project source files go in this directory
•src/main: All sources that go into primary artifact
•src/test: All sources contributing to testing project
•src/main/java: All java source files
•src/main/webapp: All web source files
•src/main/resources: All non compiled source files
•src/test/java: All java test source files
•src/test/resources: All non compiled test source files
November 14, 2016 15
Maven Build life cycles
• A Maven build follow a lifecycle
• Default lifecycle
–generate-sources/generate-resources
–compile
–test
–package
–integration-test (pre and post)
–Install
–deploy
• There is also a Clean lifecycle
November 14, 2016 16
Example Maven Goals
• To invoke a Maven build you set a lifecycle “goal”
• mvn install
–Invokes generate* and compile, test, package, integration-test, install
• mvn clean
–Invokes just clean
• mvn clean compile
–Clean old builds and execute generate*, compile
• mvn compile install
–Invokes generate*, compile, test, integration-test, package, install
• mvn test clean
–Invokes generate*, compile, test then cleans
November 14, 2016 17
Profile
• http://maven.apache.org/settings.html
• The settings element in the settings.xml file contains elements used to define values
which configure Maven execution in various ways, like the pom.xml, but should not
be bundled to any specific project, or distributed to an audience. These include
values such as the local repository location, alternate remote repository servers, and
authentication information
• There are two locations where a settings.xml file may live:
• The Maven install: $M2_HOME/conf/settings.xml
• A user's install: ${user.home}/.m2/settings.xml
November 14, 2016 18
Maven Repository
• 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
• Maven local repository is a folder location on your machine. It gets created
when you run any maven command for the first time
• default %USER_HOME%.m2
• Central
• Maven central repository is repository provided by Maven community. It
contains a large number of commonly used libraries.
• it starts searching in central repository using following URL:
http://repo1.maven.org/maven2/
November 14, 2016 19
Maven Repository
• Remote
• Maven provides concept of Remote Repository which is developer's own
custom repository containing required libraries or other project jars.
November 14, 2016 20
Search Sequence of Maven Repository
Step 1 - Search dependency in local repository, if not found, move to step 2 else if
found then do the further processing.
Step 2 - Search dependency in central repository, if not found and remote
repository/repositories is/are mentioned then move to step 4 else if found, then it is
downloaded to local repository for future reference.
Step 3 - If a remote repository has not been mentioned, Maven simply stops the
processing and throws error (Unable to find dependency).
Step 4 - Search dependency in remote repository or repositories, if found then it is
downloaded to local repository for future reference otherwise Maven as expected
stop processing and throws error (Unable to find dependency).
•
November 14, 2016 21
Transitive Depenency
• Transitive Dependency Definition:
–A dependency that should be included when declaring project itself is a
dependency
•ProjectA depends on ProjectB
•If ProjectC depends on ProjectA then ProjectB is automatically included
•Only compile and runtime scopes are transitive
•Transitive dependencies are controlled using:
–Exclusions
–Optional declarations
November 14, 2016 22
Depedency Management
<project>
...
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency> <!-- Look no version! -->
</dependencies>
</project>
November 14, 2016 23
Depedency Management
<project>
...
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
November 14, 2016 24
Maven Directory structure
• http://maven.apache.org/guides/introduction/introduction-to-the-standard-
directory-layout.html
November 14, 2016 25
Build Life cycle, phase and Goals t
Build Life cycles
1. Default
-related to compiling and packaging your project
2. clean
-related to removing temporary files from the output directory ,
including source file, compiled classes and previous JAR’s
3. site
- generating the documentation for the project
November 14, 2016 26
Build phase
Build Phases
Build Goals
Build goals are the finest steps in the Maven build process.
A goal can be bound to one or more build phases, or to none at all.
dependency:copy-dependencies
November 14, 2016 27
Maven Examples
mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-
name} -DarchetypeArtifactId=maven-archetype-quickstart
-DinteractiveMode=false

Contenu connexe

Tendances

Triple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDev
Triple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDevTriple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDev
Triple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDevWerner Keil
 
Maven: from Scratch to Production (.pdf)
Maven: from Scratch to Production (.pdf)Maven: from Scratch to Production (.pdf)
Maven: from Scratch to Production (.pdf)Johan Mynhardt
 
Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Robert Scholte
 
Introduction in Apache Maven2
Introduction in Apache Maven2Introduction in Apache Maven2
Introduction in Apache Maven2Heiko Scherrer
 
YaJUG-Maven 3.x, will it lives up to its promises
YaJUG-Maven 3.x, will it lives up to its promisesYaJUG-Maven 3.x, will it lives up to its promises
YaJUG-Maven 3.x, will it lives up to its promisesArnaud Héritier
 
BordeauxJUG-Maven 3.x, will it lives up to its promises
BordeauxJUG-Maven 3.x, will it lives up to its promisesBordeauxJUG-Maven 3.x, will it lives up to its promises
BordeauxJUG-Maven 3.x, will it lives up to its promisesArnaud Héritier
 
ToulouseJUG-Maven 3.x, will it lives up to its promises
ToulouseJUG-Maven 3.x, will it lives up to its promisesToulouseJUG-Maven 3.x, will it lives up to its promises
ToulouseJUG-Maven 3.x, will it lives up to its promisesArnaud Héritier
 
開放原始碼 Ch1.2 intro - oss - apahce foundry (ver 2.0)
開放原始碼 Ch1.2   intro - oss - apahce foundry (ver 2.0)開放原始碼 Ch1.2   intro - oss - apahce foundry (ver 2.0)
開放原始碼 Ch1.2 intro - oss - apahce foundry (ver 2.0)My own sweet home!
 
How maven makes your development group look like a bunch of professionals.
How maven makes your development group look like a bunch of professionals.How maven makes your development group look like a bunch of professionals.
How maven makes your development group look like a bunch of professionals.Fazreil Amreen Abdul Jalil
 
maven
mavenmaven
mavenakd11
 
Java 9 Module System Introduction
Java 9 Module System IntroductionJava 9 Module System Introduction
Java 9 Module System IntroductionDan Stine
 

Tendances (20)

Maven advanced
Maven advancedMaven advanced
Maven advanced
 
Triple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDev
Triple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDevTriple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDev
Triple E class DevOps with Hudson, Maven, Kokki/Multiconf and PyDev
 
Maven: from Scratch to Production (.pdf)
Maven: from Scratch to Production (.pdf)Maven: from Scratch to Production (.pdf)
Maven: from Scratch to Production (.pdf)
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)
 
Maven
MavenMaven
Maven
 
Introduction in Apache Maven2
Introduction in Apache Maven2Introduction in Apache Maven2
Introduction in Apache Maven2
 
YaJUG-Maven 3.x, will it lives up to its promises
YaJUG-Maven 3.x, will it lives up to its promisesYaJUG-Maven 3.x, will it lives up to its promises
YaJUG-Maven 3.x, will it lives up to its promises
 
BordeauxJUG-Maven 3.x, will it lives up to its promises
BordeauxJUG-Maven 3.x, will it lives up to its promisesBordeauxJUG-Maven 3.x, will it lives up to its promises
BordeauxJUG-Maven 3.x, will it lives up to its promises
 
ToulouseJUG-Maven 3.x, will it lives up to its promises
ToulouseJUG-Maven 3.x, will it lives up to its promisesToulouseJUG-Maven 3.x, will it lives up to its promises
ToulouseJUG-Maven 3.x, will it lives up to its promises
 
Liferay maven sdk
Liferay maven sdkLiferay maven sdk
Liferay maven sdk
 
開放原始碼 Ch1.2 intro - oss - apahce foundry (ver 2.0)
開放原始碼 Ch1.2   intro - oss - apahce foundry (ver 2.0)開放原始碼 Ch1.2   intro - oss - apahce foundry (ver 2.0)
開放原始碼 Ch1.2 intro - oss - apahce foundry (ver 2.0)
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
 
Maven
MavenMaven
Maven
 
Maven
MavenMaven
Maven
 
How maven makes your development group look like a bunch of professionals.
How maven makes your development group look like a bunch of professionals.How maven makes your development group look like a bunch of professionals.
How maven makes your development group look like a bunch of professionals.
 
maven
mavenmaven
maven
 
Demystifying Maven
Demystifying MavenDemystifying Maven
Demystifying Maven
 
Java 9 Module System Introduction
Java 9 Module System IntroductionJava 9 Module System Introduction
Java 9 Module System Introduction
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 

Similaire à MAVEN

Similaire à MAVEN (20)

Maven
MavenMaven
Maven
 
Introduction tomaven
Introduction tomavenIntroduction tomaven
Introduction tomaven
 
Introduction to Maven for beginners and DevOps
Introduction to Maven for beginners and DevOpsIntroduction to Maven for beginners and DevOps
Introduction to Maven for beginners and DevOps
 
Maven
MavenMaven
Maven
 
Introduction to maven
Introduction to mavenIntroduction to maven
Introduction to maven
 
Mavennotes.pdf
Mavennotes.pdfMavennotes.pdf
Mavennotes.pdf
 
Maven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafeMaven Presentation - SureFire vs FailSafe
Maven Presentation - SureFire vs FailSafe
 
Ci jenkins maven svn
Ci jenkins maven svnCi jenkins maven svn
Ci jenkins maven svn
 
Maven 3 Overview
Maven 3  OverviewMaven 3  Overview
Maven 3 Overview
 
Build Automation using Maven
Build Automation using Maven Build Automation using Maven
Build Automation using Maven
 
Maven overview
Maven overviewMaven overview
Maven overview
 
S/W Design and Modularity using Maven
S/W Design and Modularity using MavenS/W Design and Modularity using Maven
S/W Design and Modularity using Maven
 
Intro to Maven.ppt
Intro to Maven.pptIntro to Maven.ppt
Intro to Maven.ppt
 
Maven
MavenMaven
Maven
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
 
Maven in mulesoft
Maven in mulesoftMaven in mulesoft
Maven in mulesoft
 
Maven
MavenMaven
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
 
4 maven junit
4 maven junit4 maven junit
4 maven junit
 
Maven Nexus
Maven NexusMaven Nexus
Maven Nexus
 

MAVEN

  • 2. November 14, 2016 2 • Maven is a project management and comprehension tool. • Maven projects is powerful tool for Java projects • What is Maven ? Maven is a software management and comprehension tool based on the concept of Project Object Model (POM) which can manage project build, reporting, and documentation from a central piece of information. • What is POM ? As a fundamental unit of work in Maven, POM is an XML file that contains information about project and configuration details used by Maven to build the project. Overview ?
  • 3. November 14, 2016 3 • Maven is more than just Build tool. • Characteristics – Visibility – Reusability – Maintainability – Comprehensibility “Accumulator of knowledge” • Objectives – Easy build process – Uniform build system – Quality Project Information – Guidelines for Best Practices Development Objectives and Characteristics ?
  • 4. November 14, 2016 4 1. One level above ANT 2. Higher level of reusability between builds 3. Faster turn around time to set up a powerful build 4. Project website generation 5. Less maintenance 6. Greater momentum 7. Repository management 8. Automatic downloads Maven website http://maven.apache.org Comparision with ANT ANT MAVEN Target build.xml Goal pom.xml
  • 5. November 14, 2016 5 • Download MAVEN http://maven.apache.org/download.cgi and unzip Maven. • Set the M2_HOME environment variable to point to the directory you unzipped Maven to. • Set the M2 environment variable to point to M2_HOME/bin (%M2_HOME%bin on Windows, $M2_HOME/bin on unix). • Add M2 to the PATH environment variable (%M2% on Windows, $M2 on unix). • Open a command prompt and type 'mvn' (without quotes) and press enter. Installation of MAVEN
  • 6. November 14, 2016 6 • Apache project – Sponsored by sonatype • History – Maven 1 (2003) • Very Ugly • Used in Stack 1 – Maven 2 (2005) • Complete rewrite • Not backwards Compatible • Used in Stack 2.0,2.1,2.2,3.0 – Maven 3 (2010) • Same as Maven 2 but more stable • Used in Stack 2.3, 3.1,3.2.1 History
  • 7. November 14, 2016 7 • Maven Homepage – http://maven.apache.org • Reference Documentation for Maven • Reference Documentation for core Plugins • Sonatype Resources – http://www.sonatype.com/resource-center.html • Free Books • Videos Maven learning Courses
  • 8. November 14, 2016 8 • Stands for Project Object Model • Describes a project – Name and Version – Artifact Type – Source Code Locations – Dependencies – Plugins – Profiles (Alternate build configurations) • Uses XML by Default – Not the way Ant uses XML Maven POM
  • 9. November 14, 2016 9 Maven POM
  • 10. November 14, 2016 10 Project Name •Maven uniquely identifies a project using: –groupID: Arbitrary project grouping identifier (no spaces or colons) •Usually loosely based on Java package –artfiactId: Arbitrary name of project (no spaces or colons) –version: Version of project •Format {Major}.{Minor}.{Maintanence} •Add ‘-SNAPSHOT ‘ to identify in development •GAV Syntax: groupId:artifactId:version <?xml version="1.0" encoding="UTF-8"?> <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> <artifactId>maven-training</artifactId> <groupId>org.learning</groupId> <version>1.0</version> </project>
  • 11. November 14, 2016 11 Packaging •Build type identified using the “packaging” element •Tells Maven how to build the project •Example packaging types: –pom, jar, war, ear, custom –Default is jar <?xml version="1.0" encoding="UTF-8"?> <project> <modelVersion>4.0.0</modelVersion> <artifactId>maven-training</artifactId> <groupId>org.learning</groupId> <version>1.0</version> <packaging>jar</packaging> </project>
  • 12. November 14, 2016 12 Project Inheritance • Pom files can inherit configuration –groupId, version –Project Config –Dependencies –Plugin configuration –Etc. <?xml version="1.0" encoding="UTF-8"?> <project> <parent> <artifactId>maven-training-parent</artifactId> <groupId>org.learning.training</groupId> <version>1.0</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>maven-training</artifactId> <groupId>org.learning.training</groupId> <version>1.0</version> <packaging>jar</packaging> </project>
  • 13. November 14, 2016 13 Multi Module Project • Pom Maven has 1st class multi-module support • Each maven project creates 1 primary artifact • A parent pom is used to group modules <project> ... <packaging>pom</packaging> <modules> <module>maven-training</module> <module>maven-training-web</module> </modules> </project>
  • 14. November 14, 2016 14 Maven Conventions •Maven is opinionated about project structure •target: Default work directory •src: All project source files go in this directory •src/main: All sources that go into primary artifact •src/test: All sources contributing to testing project •src/main/java: All java source files •src/main/webapp: All web source files •src/main/resources: All non compiled source files •src/test/java: All java test source files •src/test/resources: All non compiled test source files
  • 15. November 14, 2016 15 Maven Build life cycles • A Maven build follow a lifecycle • Default lifecycle –generate-sources/generate-resources –compile –test –package –integration-test (pre and post) –Install –deploy • There is also a Clean lifecycle
  • 16. November 14, 2016 16 Example Maven Goals • To invoke a Maven build you set a lifecycle “goal” • mvn install –Invokes generate* and compile, test, package, integration-test, install • mvn clean –Invokes just clean • mvn clean compile –Clean old builds and execute generate*, compile • mvn compile install –Invokes generate*, compile, test, integration-test, package, install • mvn test clean –Invokes generate*, compile, test then cleans
  • 17. November 14, 2016 17 Profile • http://maven.apache.org/settings.html • The settings element in the settings.xml file contains elements used to define values which configure Maven execution in various ways, like the pom.xml, but should not be bundled to any specific project, or distributed to an audience. These include values such as the local repository location, alternate remote repository servers, and authentication information • There are two locations where a settings.xml file may live: • The Maven install: $M2_HOME/conf/settings.xml • A user's install: ${user.home}/.m2/settings.xml
  • 18. November 14, 2016 18 Maven Repository • 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 • Maven local repository is a folder location on your machine. It gets created when you run any maven command for the first time • default %USER_HOME%.m2 • Central • Maven central repository is repository provided by Maven community. It contains a large number of commonly used libraries. • it starts searching in central repository using following URL: http://repo1.maven.org/maven2/
  • 19. November 14, 2016 19 Maven Repository • Remote • Maven provides concept of Remote Repository which is developer's own custom repository containing required libraries or other project jars.
  • 20. November 14, 2016 20 Search Sequence of Maven Repository Step 1 - Search dependency in local repository, if not found, move to step 2 else if found then do the further processing. Step 2 - Search dependency in central repository, if not found and remote repository/repositories is/are mentioned then move to step 4 else if found, then it is downloaded to local repository for future reference. Step 3 - If a remote repository has not been mentioned, Maven simply stops the processing and throws error (Unable to find dependency). Step 4 - Search dependency in remote repository or repositories, if found then it is downloaded to local repository for future reference otherwise Maven as expected stop processing and throws error (Unable to find dependency). •
  • 21. November 14, 2016 21 Transitive Depenency • Transitive Dependency Definition: –A dependency that should be included when declaring project itself is a dependency •ProjectA depends on ProjectB •If ProjectC depends on ProjectA then ProjectB is automatically included •Only compile and runtime scopes are transitive •Transitive dependencies are controlled using: –Exclusions –Optional declarations
  • 22. November 14, 2016 22 Depedency Management <project> ... <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>3.0.5.RELEASE</version> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> </dependency> <!-- Look no version! --> </dependencies> </project>
  • 23. November 14, 2016 23 Depedency Management <project> ... <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>3.0.5.RELEASE</version> </dependency> </dependencies> </dependencyManagement> </project>
  • 24. November 14, 2016 24 Maven Directory structure • http://maven.apache.org/guides/introduction/introduction-to-the-standard- directory-layout.html
  • 25. November 14, 2016 25 Build Life cycle, phase and Goals t Build Life cycles 1. Default -related to compiling and packaging your project 2. clean -related to removing temporary files from the output directory , including source file, compiled classes and previous JAR’s 3. site - generating the documentation for the project
  • 26. November 14, 2016 26 Build phase Build Phases Build Goals Build goals are the finest steps in the Maven build process. A goal can be bound to one or more build phases, or to none at all. dependency:copy-dependencies
  • 27. November 14, 2016 27 Maven Examples mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project- name} -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false