Apache Maven 2. Part 1: Overview
Getting started with Apache Maven 2
Nikolay Khasanov, Anatoly Kondratyev
October 2012
23 January 2013
Exigen Services confidential Exigen Services confidential
The Goal
• Understand Maven principles
• Build project with Maven
• Compare to Apache Ant
Exigen Services confidential 2
What is Maven?
GETTING STARTED
Exigen Services confidential 3
What is Maven?
• Build automation tool
• Open Source: Apache License 2.0
• Knowledge accumulator
• Declarative logic instead of imperative
Exigen Services confidential 5
Maven’s Objectives
• Making the build process easy
• Providing a uniform build system
• Providing quality project information
• Providing guidelines for best practices
development
Exigen Services confidential 6
Maven does your work
• Store only source code
• Maven knows how to build
• Dependencies are stored in shared
repository
Exigen Services confidential 12
Dependency scope
Result Compile Runtime Test Lookup
Scope classpath classpath classpath repository
compile + + + +
provided + - + +
runtime - + + +
test - - + +
system + - + -
import Maven 2.0.9 or later, replaces POM with
<dependencyManagement>
Exigen Services confidential 14
Maven Repository
Local repository External repositories
user local internal external
Central (default)
Maven
User workstation Local network Internet
Exigen Services confidential 16
Install and Deploy
deploy
local developer 1
internal
local developer 2
install
…
external
local developer N
Local network Internet
Exigen Services confidential 28
When deploy is needed?
• Release
• Update snapshot
• Available for other projects
Exigen Services confidential 29