Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Maven Essentials

Basics of maven
by

nambi sankaran

on 15 January 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Maven Essentials

Project with many sub-projects
Create using archetype
Aggregator, Parent, Super Pom Multi-module Project Artifact Details
Project GAV (Coordinates)
groupId : artifactId : version
Packaging
jar, war, bundle
Classifier
sources, javadoc
Scope
compile, test, provided, system Coordinates Creating a project
Archetypes
Project templates
CLI
mvn archetype:generate
Eclipse
Project -> new -> maven
Demo Simple Project Setup Project Life Cycle
Standard Directory Layout
POM
Plugins
Dependency Management
Release and Distribution
Project Documentation (Site) Maven Essentials Task based Vs Life Cycle based
Configuration Vs Convention Ant Vs Maven Q & A http://www.sonatype.com/Support/Books Further Reading Release : Prepare
No SNAPSHOT dependencies
All Tests must pass
Changes the versions to release versions
Commit
Tags in SCM
Increments Version
Commit
Release : Perform
Checks out from TAG
Deploys to “release” repository Releases DistributionManagement
repository
snapshotRepository
User Id / Password stored in settings.xml
SNAPSHOT version
1.0.1-SNAPSHOT
1.0.1-20121022-042333-23.jar
Release version
1.0.1
Snapshot Update Policy
“always", "daily" (default), "interval:XXX" (in minutes) or "never"
mvn –U --update-snapshots Distribution Dependency mediation
Nearest
A  B1.0  C2.5  D1.0
A  Y2.4  D2.5
First
A  B1.0  C2.5  D1.0
A  Y2.4  X3.2  D2.5
Dependency management
Transitive dependencies
D2.4
Dependencies without versions Dependency mechanism Mirrors
Maven Central
Proxies
Faster Downloads
Increases reliability
Plugin Repositories
Repository Managers
Nexus, Artifactory, Archiva Maven Repositories M2Eclipse Preferences
Settings.xml
External Maven Installation
M2Eclipse Context Menu M2eclipse menus M2Eclipse pom Editor
Editing the pom.xml
Adding dependencies
Using code completion
Dependency Hierarchy
Effective pom
CLI effective pom
mvn help:effective-pom Pom Editor Import Into Eclipse
Import as maven project
Import as eclipse project
Identifying a maven project
Look for “M” icon
Maven Classpath Container
Compile classpath
Test classpath Eclipse Integration Maven is a collection of plugins
Core Plugins
http://maven.apache.org/plugins/index.html
Custom Plugins
Invoking plugins
groupId:artifactId:version:goal
org.apache.maven.plugins:maven-dependency-plugin:tree
dependency:tree Plugins Phases
mvn compile
mvn package

Goals
mvn dependency:tree Standard Directory Layout
src/main/java
src/main/resources
src/main/webapp
src/test/java
src/test/resources
Directory Layout may be changed
But, standard behaviors may not work
But, plugins may not work as expected
Hard for others to understand
Avoid as much as possible Standard Directory Layout Maven Home M2_HOME
Settings File
$HOME/.m2/settings.xml
Optional
Local Maven Repository
$HOME/.m2/repository ( default)
Overridden by settings.xml
mvn –v

$mvn -v
Apache Maven 3.0.3 (r1075438; 2011-02-28 09:31:09-0800)
Maven home: /Users/nsankaran/Installations/ride-1.3.0/apache-maven-3.0.3
Java version: 1.6.0_35, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.6.8", arch: "x86_64", family: "mac" Maven Installation Nambi Sankaran Maven Training Life-Cycles
Clean life-cycle
Default life-cycle
Site life-cycle
Default Life-Cycle Phases
compile, test, package, install, deploy
Invokes previous phases
Phases are made of goals Project Life Cycle Project management system for Java
Build is an aspect of project management
Dependency management
Release management
Distribution
Uniform Structure
Much more… What is Maven?
Full transcript