• Like
Using Maven 2
Upcoming SlideShare
Loading in...5
×

Using Maven 2

  • 6,183 views
Uploaded on

Quick introduction to maven2

Quick introduction to maven2

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
6,183
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
263
Comments
0
Likes
3

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • http://www.apache.org/dev/pmc.html – Project Management Committee

Transcript

  • 1. Using Maven 2 Andreas Andreou [email_address] amplafi.com, co-founder apache tapestry, committer – PMC
  • 2. History
    • Alexandria
    • Forrest
    • Gump
    • Maven
    • Turbine
    • Tomcat
    • Ant
    • James Duncan Davidson, Sam Ruby, Jason van Zyl, Bob McWhirter
  • 3. What is Maven?
    • Project management tool = more than a build tool
    • POM (project object model)
    • Dependency management system
    • Convention over configuration
    • Project lifecycle
    • Execution logic for each phase in lifecycle
  • 4. POM
    • Project coordinates
      • groupId
      • artifactId
      • version
      • packaging (jar, war, ear, maven-plugin, …)
    • Project info (developers, website, scm url)
    • Dependencies
    • Plugins
  • 5. Installing Maven
    • Download / extract zip
    • Set M2_HOME env-var
    • Add M2_HOME/bin to path
    • Folders created when maven is used:
      • USER_HOME/.m2/repository/
      • USER_HOME/.m2/settings.xml
  • 6. Simplest pom.xml
    • <project> <modelVersion> 4.0.0 </modelVersion> <groupId> gr.jhug </groupId> <artifactId> javabb </artifactId> <version> 1.0-SNAPSHOT </version> <packaging> jar </packaging> <name> PHPBB-NUKE-killer </name> </project>
    src/main/ src/main/java/ src/main/resources/ src/test/ src/test/java src/test/resources
  • 7. Maven Lifecycle
    • validate
    • generate-sources
    • process-resources
    • compile
    • test-compile
    • test
    • package
    • install
    • verify
    • deploy
    • Maven execution needs phase and runs all previous:
      • mvn compile
    • … or standalone plugin goal:
      • mvn jetty:run
      • mvn scm:update
  • 8. Some more plugins
    • maven-clean-plugin
    • maven-compiler-plugin
    • maven-jar-plugin
    • maven-war-plugin
    • maven-dependency-plugin
    • maven-release-plugin
    • maven-source-plugin
    • maven-surefire-plugin
    • maven-ant-plugin
    • maven-archetype-plugin
    • maven-checkstyle-plugin
    • maven-pmd-plugin
  • 9. Dependencies
    • Uses groupId, artifactId, version
    • Supports transitive dependencies
    • Needs correct usage of ‘scope’
      • compile
      • test
      • provided
      • runtime
      • system
    • Retrieved from public locations (ibiblio, e.t.c.)
    • Stored on local repo (~/.m2/repository/)
  • 10. Versions in Dependencies
    • <major>.<minor>.<revision> ([ -<qualifier> ] | [ -<build> ])
    • 4.1.6
    • 4.1.6-SNAPSHOT
    • [4.1.6,5)
    • If same dependency included more than once (how???), biggest wins
  • 11. Maven & IDEs
    • Supported in all major IDEs
    • From pom.xml generate IDE specific files
      • mvn eclipse:eclipse
      • mvn idea:idea
    • Directly read pom.xml and setup project
      • 2 plugins for eclipse: m2eclipse, q4e
      • Bundled plugin in IDEA
      • Plugin from update center for Netbeans
    • … but maven is (still) more powerful!
  • 12. Repository Manager
    • Proxies between your organization and the public Maven repositories
    • Deployment destination for your own generated artifacts
    • Sonatype Nexus
    • Maven Archiva
    • Artifactory
  • 13. Links
    • http://ant.apache.org/faq.html
    • http://maven.apache.org/background/history-of-maven.html
    • http://jakarta.apache.org/alexandria/legacy/
    • http://gump.apache.org/why.html
    • http://www.sonatype.com/books/maven-book/index.html
    • http://maven.apache.org/repository-management.html
    • http://delicious.com/andyhot/maven
  • 14. Demo - Q&A
  • 15. Companies
    • sonatype.com
      • Jason van Zyl, Mark de Visser, Brian Fox, John Casey
      • Nexus, m2eclipse
    • Exist <- DevZuz <- Mergere
      • Brett Porter, Carlos Sanchez
      • q4e