Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Using Maven 2 Andreas Andreou [email_address] amplafi.com, co-founder apache tapestry, committer – PMC
History <ul><li>Alexandria </li></ul><ul><li>Forrest </li></ul><ul><li>Gump </li></ul><ul><li>Maven </li></ul><ul><li>Turb...
What is Maven? <ul><li>Project management tool = more than a build tool </li></ul><ul><li>POM (project object model) </li>...
POM <ul><li>Project coordinates  </li></ul><ul><ul><li>groupId </li></ul></ul><ul><ul><li>artifactId </li></ul></ul><ul><u...
Installing Maven <ul><li>Download / extract zip </li></ul><ul><li>Set  M2_HOME  env-var  </li></ul><ul><li>Add M2_HOME/bin...
Simplest pom.xml <ul><li><project> <modelVersion> 4.0.0 </modelVersion> <groupId> gr.jhug </groupId> <artifactId> javabb <...
Maven Lifecycle <ul><li>validate </li></ul><ul><li>generate-sources </li></ul><ul><li>process-resources </li></ul><ul><li>...
Some more plugins <ul><li>maven-clean-plugin </li></ul><ul><li>maven-compiler-plugin </li></ul><ul><li>maven-jar-plugin </...
Dependencies <ul><li>Uses groupId, artifactId, version </li></ul><ul><li>Supports transitive dependencies </li></ul><ul><l...
Versions in Dependencies <ul><li><major>.<minor>.<revision> ([ -<qualifier> ] | [ -<build> ]) </li></ul><ul><li>4.1.6 </li...
Maven & IDEs <ul><li>Supported in all major IDEs </li></ul><ul><li>From pom.xml generate IDE specific files </li></ul><ul>...
Repository Manager <ul><li>Proxies between your organization and the public Maven repositories </li></ul><ul><li>Deploymen...
Links <ul><li>http://ant.apache.org/faq.html </li></ul><ul><li>http://maven.apache.org/background/history-of-maven.html </...
Demo - Q&A
Companies <ul><li>sonatype.com </li></ul><ul><ul><li>Jason van Zyl, Mark de Visser, Brian Fox, John Casey </li></ul></ul><...
Upcoming SlideShare
Loading in …5
×

Using Maven 2

7,287 views

Published on

Quick introduction to maven2

Published in: Technology
  • Be the first to comment

Using Maven 2

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

×