Using Maven2

3,572
-1

Published on

Published in: Technology
0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,572
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
242
Comments
0
Likes
7
Embeds 0
No embeds

No notes for slide

Using Maven2

  1. 1. Using Maven2
  2. 2. Free Maven Books <ul><li>Maven: The Definitive Guide (alpha)‏ </li></ul><ul><li>www.sonatype.com/book </li></ul>Better Builds with Maven www.mergere.com
  3. 3. The Maven Site <ul><li>http://maven.apache.org/ </li></ul>
  4. 4. What is Maven? <ul><li>Build lifecycle </li></ul><ul><li>Dependency management tool </li></ul><ul><li>Artifact repository </li></ul><ul><li>Collection of plugins </li></ul><ul><li>Project reporting tool </li></ul><ul><li>Set of conventions </li></ul><ul><li>Distilled experience </li></ul>
  5. 5. What Else is Maven? <ul><li>Succinct command line tool </li></ul><ul><li>Designed for Java/Java EE/other </li></ul><ul><li>Holder/publisher of project documentation </li></ul><ul><li>Generator of project metrics </li></ul><ul><li>Customisable: environment, lifecycle, etc </li></ul><ul><li>Inheritable </li></ul><ul><li>Declarative </li></ul><ul><li>Encourager of modularity and reuse </li></ul><ul><li>Integrated with SCM tools </li></ul><ul><li>Integrated with IDEs </li></ul><ul><li>Integrated with Ant </li></ul><ul><li>System of repositories </li></ul><ul><li>Project kick starter </li></ul><ul><li>Release manager </li></ul><ul><li>Deployer </li></ul><ul><li>Enabler of portable build knowledge </li></ul><ul><li>Encourager of best practice </li></ul><ul><li>Community </li></ul><ul><li>Not perfect </li></ul>
  6. 6. Quick Start <ul><li>Download Maven2, unzip, add bin directory to $PATH </li></ul><ul><li>Configure proxy in ~/.m2/settings.xml if required </li></ul>$ mvn archetype:create -DgroupId=com.example -DartifactId=my-app
  7. 7. Directory Structure Convention <ul><li>Java sources: src/main/java </li></ul><ul><li>Unit tests: src/test/java </li></ul><ul><li>pom.xml </li></ul>
  8. 8. pom.xml – The Project Object Model <ul><li><project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; </li></ul><ul><li>xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; </li></ul><ul><li>xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 </li></ul><ul><li>http://maven.apache.org/maven-v4_0_0.xsd&quot;> </li></ul><ul><li><modelVersion>4.0.0</modelVersion> </li></ul><ul><li><groupId> com.example </groupId> </li></ul><ul><li><artifactId> my-app </artifactId> </li></ul><ul><li><packaging>jar</packaging> </li></ul><ul><li><version>1.0-SNAPSHOT</version> </li></ul><ul><li><name>my-app</name> </li></ul><ul><li><url>http://maven.apache.org</url> </li></ul><ul><li><dependencies> </li></ul><ul><li><dependency> </li></ul><ul><li><groupId>junit</groupId> </li></ul><ul><li><artifactId>junit</artifactId> </li></ul><ul><li><version>3.8.1</version> </li></ul><ul><li><scope>test</scope> </li></ul><ul><li></dependency> </li></ul><ul><li></dependencies> </li></ul><ul><li></project> </li></ul>
  9. 9. Directory Structure Convention <ul><li>Added: </li></ul><ul><li>My app sources </li></ul><ul><li>Properties file: src/main/resources/ messages.poperties </li></ul><ul><li>My unit test </li></ul>
  10. 10. Killer App <ul><li>package com.example; </li></ul>public class Hello { public static void main(String[] args){ ResourceBundle messages = ResourceBundle.getBundle(&quot;messages&quot;); MessagePrinter mp = new MessagePrinter(); mp.printMessage(messages.getString(&quot;message1&quot;), System.out); mp.printMessage(&quot; &quot;, System.out); } } public class MessagePrinter { public void printMessage(String message, OutputStream os){ PrintWriter pw = new PrintWriter(os); pw.print(message); pw.flush(); } }
  11. 11. My Application POM <ul><li><project ...> </li></ul><ul><li>... </li></ul><ul><li><name> My Application </name> </li></ul><ul><li><url>http://localhost:8080/my-app</url> </li></ul><ul><li>... </li></ul><ul><li><build> </li></ul><ul><li><plugins> </li></ul><ul><li><plugin> </li></ul><ul><li><artifactId>maven-jar-plugin</artifactId> </li></ul><ul><li><configuration> </li></ul><ul><li><archive> </li></ul><ul><li><manifest> </li></ul><ul><li><mainClass> com.example.Hello </mainClass> </li></ul><ul><li></manifest> </li></ul><ul><li></archive> </li></ul><ul><li></configuration> </li></ul><ul><li></plugin> </li></ul><ul><li></plugins> </li></ul><ul><li></build> </li></ul><ul><li></project> </li></ul>
  12. 12. Eclipse Integration <ul><li>Maven2 plugin for Eclipse; either from project root execute: $ mvn eclipse:eclipse and import with Eclipse, or create the project in Eclipse and add the Maven2 project nature </li></ul>
  13. 13. Eclipse Integration
  14. 14. Ready for Take Off <ul><li>$ mvn package </li></ul>
  15. 15. stdout <ul><li>[INFO] Scanning for projects... </li></ul><ul><li>[INFO] ---------------------------------------------------------------------------- </li></ul><ul><li>[INFO] Building My Application </li></ul><ul><li>[INFO] task-segment: [package] </li></ul><ul><li>[INFO] ---------------------------------------------------------------------------- </li></ul><ul><li>[INFO] [resources:resources] </li></ul><ul><li>[INFO] Using default encoding to copy filtered resources. </li></ul><ul><li>[INFO] [compiler:compile] </li></ul><ul><li>[INFO] Compiling 1 source file to /home/russell/Desktop/maven-presentation/example/my-app/target/classes </li></ul><ul><li>[INFO] [resources:testResources] </li></ul><ul><li>[INFO] Using default encoding to copy filtered resources. </li></ul><ul><li>[INFO] [compiler:testCompile] </li></ul><ul><li>[INFO] Compiling 1 source file to /home/russell/Desktop/maven-presentation/example/my-app/target/test-classes </li></ul><ul><li>[INFO] [surefire:test] </li></ul><ul><li>[INFO] Surefire report directory: /home/russell/Desktop/maven-presentation/example/my-app/target/surefire-reports </li></ul><ul><li>------------------------------------------------------- </li></ul><ul><li>T E S T S </li></ul><ul><li>------------------------------------------------------- </li></ul><ul><li>Running com.example.AppTest </li></ul><ul><li>Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.022 sec </li></ul><ul><li>Results : </li></ul><ul><li>Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 </li></ul><ul><li>[INFO] [jar:jar] </li></ul><ul><li>[INFO] Building jar: /home/russell/Desktop/maven-presentation/example/my-app/target/my-app-1.0-SNAPSHOT.jar </li></ul><ul><li>[INFO] ------------------------------------------------------------------------ </li></ul><ul><li>[INFO] BUILD SUCCESSFUL </li></ul><ul><li>[INFO] ------------------------------------------------------------------------ </li></ul><ul><li>[INFO] Total time: 3 seconds </li></ul><ul><li>[INFO] Finished at: Wed Jul 04 11:11:55 NZST 2007 </li></ul><ul><li>[INFO] Final Memory: 4M/11M </li></ul><ul><li>[INFO] ------------------------------------------------------------------------ </li></ul>
  16. 16. The (Almost) Finished Product <ul><li>Classes and test classes compiled </li></ul><ul><li>Resources copied to classes directory </li></ul><ul><li>Test reports created </li></ul><ul><li>Jar file created </li></ul>$ java -jar my-app-1.0-SNAPSHOT.jar Hello World!
  17. 17. Plugins & Goals <ul><li>A plugin contains one or more goals (Goal a.k.a. Mojo; Maven + Pojo = Mojo  ?!@! )‏ </li></ul><ul><li>A plugin is a Maven artifact </li></ul><ul><li>A goal is uniquely referenced/invoked by: groupId:artifactId:version:goal e.g: org.apache.maven.plugins:maven-eclipse-plugin:eclipse defaults shorten this to: eclipse:eclipse </li></ul>
  18. 18. Anatomy of a Maven Command <ul><li>1. Invoke a specific goal: </li></ul><ul><li>$ mvn [options] plugin:goal [parameter]... </li></ul><ul><li>e.g: </li></ul><ul><li>$ mvn -e eclipse:eclipse </li></ul><ul><li>-> Generate Eclipse configuration, print verbose error messages </li></ul>2. Invoke goals bound to the lifecycle(s) up to and including a phase: $ mvn [options] phase... [parameter]... e.g: $ mvn clean package -Dmaven.test.skip=true -> Clean target, build package, skip tests
  19. 19. Maven Lifecycles <ul><li>Three built-in lifecycles: </li></ul><ul><ul><li>default </li></ul></ul><ul><ul><li>clean </li></ul></ul><ul><ul><li>site </li></ul></ul><ul><li>You can create your own lifecycle, but only if you have really weird build requirements! </li></ul>
  20. 20. The Default Build Lifecycle
  21. 21. Project Packaging <ul><li><project ...> </li></ul><ul><li><modelVersion>4.0.0</modelVersion> </li></ul><ul><li><groupId>com.example</groupId> </li></ul><ul><li><artifactId>my-app</artifactId> </li></ul><ul><li><packaging> jar </packaging> </li></ul><ul><li><version>1.0-SNAPSHOT</version> </li></ul><ul><li>... </li></ul><ul><li></project> </li></ul>
  22. 22. Lifecycle Bindings
  23. 23. Build Lifecycle <ul><li>$ mvn package </li></ul>
  24. 24. stdout <ul><li>[INFO] Scanning for projects... </li></ul><ul><li>[INFO] ---------------------------------------------------------------------------- </li></ul><ul><li>[INFO] Building My Application </li></ul><ul><li>[INFO] task-segment: [package] </li></ul><ul><li>[INFO] ---------------------------------------------------------------------------- </li></ul><ul><li>[INFO] [resources:resources] </li></ul><ul><li>[INFO] Using default encoding to copy filtered resources. </li></ul><ul><li>[INFO] [compiler:compile] </li></ul><ul><li>[INFO] Compiling 1 source file to /home/russell/Desktop/maven-presentation/example/my-app/target/classes </li></ul><ul><li>[INFO] [resources:testResources] </li></ul><ul><li>[INFO] Using default encoding to copy filtered resources. </li></ul><ul><li>[INFO] [compiler:testCompile] </li></ul><ul><li>[INFO] Compiling 1 source file to /home/russell/Desktop/maven-presentation/example/my-app/target/test-classes </li></ul><ul><li>[INFO] [surefire:test] </li></ul><ul><li>[INFO] Surefire report directory: /home/russell/Desktop/maven-presentation/example/my-app/target/surefire-reports </li></ul><ul><li>------------------------------------------------------- </li></ul><ul><li>T E S T S </li></ul><ul><li>------------------------------------------------------- </li></ul><ul><li>Running com.example.AppTest </li></ul><ul><li>Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.022 sec </li></ul><ul><li>Results : </li></ul><ul><li>Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 </li></ul><ul><li>[INFO] [jar:jar] </li></ul><ul><li>[INFO] Building jar: /home/russell/Desktop/maven-presentation/example/my-app/target/my-app-1.0-SNAPSHOT.jar </li></ul><ul><li>[INFO] ------------------------------------------------------------------------ </li></ul><ul><li>[INFO] BUILD SUCCESSFUL </li></ul><ul><li>[INFO] ------------------------------------------------------------------------ </li></ul><ul><li>[INFO] Total time: 3 seconds </li></ul><ul><li>[INFO] Finished at: Wed Jul 04 11:11:55 NZST 2007 </li></ul><ul><li>[INFO] Final Memory: 4M/11M </li></ul><ul><li>[INFO] ------------------------------------------------------------------------ </li></ul>
  25. 25. Dependencies <ul><li><project ...> </li></ul><ul><li>... </li></ul><ul><li><dependencies> </li></ul><ul><li><dependency> </li></ul><ul><li><groupId>junit</groupId> </li></ul><ul><li><artifactId>junit</artifactId> </li></ul><ul><li><version>3.8.1</version> </li></ul><ul><li><scope>test</scope> </li></ul><ul><li></dependency> </li></ul><ul><li></dependencies> </li></ul><ul><li></project> </li></ul><ul><li>Explicitly declared, including version </li></ul><ul><li>Resolved by Maven, not required in project directory / source control repository </li></ul><ul><li>Scoped: compile, provided, runtime, test </li></ul><ul><li>SNAPSHOT dependencies updated </li></ul><ul><li>Transitive </li></ul><ul><li>Strictly acyclic (a DAG not a tree)‏ </li></ul>
  26. 26. Killer App Reloaded <ul><li>public class Hello { </li></ul><ul><li>public static void main(String[] args) { </li></ul><ul><li>ReloadableResourceBundleMessageSource messages </li></ul><ul><li>= new ReloadableResourceBundleMessageSource(); </li></ul><ul><li>messages.setCacheSeconds(1); </li></ul><ul><li>messages.setBasename(&quot;messages&quot;); </li></ul><ul><li>MessagePrinter mp = new MessagePrinter(); </li></ul><ul><li>Scanner scanner = new Scanner(System.in); </li></ul><ul><li>do { </li></ul><ul><li>String message = messages.getMessage(&quot;message1&quot;, null, </li></ul><ul><li>Locale.getDefault()); </li></ul><ul><li>mp.printMessage(message, System.out); </li></ul><ul><li>mp.printMessage(&quot; &quot;, System.out); </li></ul><ul><li>mp.printMessage(&quot;Keep playing? [Y/n] &quot;, System.out); </li></ul><ul><li>} while (!&quot;n&quot;.equals(scanner.nextLine())); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
  27. 27. Dependencies <ul><li><project ...> </li></ul><ul><li>... </li></ul><ul><li><dependencies> </li></ul><ul><li><dependency> </li></ul><ul><li><groupId>org.springframework</groupId> </li></ul><ul><li><artifactId>spring-context</artifactId> </li></ul><ul><li><version> [2.0,) </version> </li></ul><ul><li><exclusions> </li></ul><ul><li><exclusion> </li></ul><ul><li><groupId>org.springframework</groupId> </li></ul><ul><li><artifactId>spring-aop</artifactId> </li></ul><ul><li></exclusion> </li></ul><ul><li>... </li></ul><ul><li></project> </li></ul><ul><li>Version ranges </li></ul><ul><li>Use exclusions to trim unwanted dependencies </li></ul>
  28. 28. Transitive Dependencies
  29. 29. Reloadable Message Source <ul><li>Hello World! </li></ul><ul><li>Keep playing? [Y/n] </li></ul><ul><li>y </li></ul><ul><li>Hello Again World! </li></ul><ul><li>Keep playing? [Y/n] </li></ul><ul><li>n </li></ul><ul><li>Note for anyone trying this at home: there's a bit of classpath config required to get this working nicely. It's easiest to run it on the Eclipse console, and modify the target messages.properties </li></ul>
  30. 30. Configuring Plugins e.g. Ant <ul><li><project...> </li></ul><ul><li>... </li></ul><ul><li><build> </li></ul><ul><li><plugins> </li></ul><ul><li><plugin> </li></ul><ul><li><artifactId>maven-antrun-plugin</artifactId> </li></ul><ul><li><executions> </li></ul><ul><li><execution> </li></ul><ul><li><phase>generate-sources</phase> </li></ul><ul><li><configuration> </li></ul><ul><li><tasks> </li></ul><ul><li><!-- </li></ul><ul><li>Place any ant task here. You can add anything you can add </li></ul><ul><li>between <target> and </target> in a build.xml. </li></ul><ul><li>--> </li></ul><ul><li></tasks> </li></ul><ul><li></configuration> </li></ul><ul><li><goals> </li></ul><ul><li><goal>run</goal> </li></ul><ul><li></goals> </li></ul><ul><li></execution> </li></ul><ul><li></executions> </li></ul><ul><li></plugin> </li></ul><ul><li></plugins> </li></ul><ul><li></build> </li></ul><ul><li></project> </li></ul>
  31. 31. Standard Maven Plugins <ul><li>clean </li></ul><ul><li>compiler </li></ul><ul><li>deploy </li></ul><ul><li>install </li></ul><ul><li>resources </li></ul><ul><li>site </li></ul><ul><li>surefire </li></ul><ul><li>verifier </li></ul><ul><li>ear </li></ul><ul><li>ejb </li></ul><ul><li>jar </li></ul><ul><li>rar </li></ul><ul><li>war </li></ul><ul><li>changelog </li></ul>changes checkstyle clover doap docck javadoc jxr pmd project-info-reports surefire-report ant antlr antrun archetype assembly dependency enforcer gpg help invoker one plugin release remote-resources repository scm source eclipse idea Codehaus: build-helper castor javacc jdepend native sql taglist Other: cargo jaxme jetty jalopy Listed at: http://maven.apache.org/plugins/
  32. 32. POM Inheritance <ul><li><project> </li></ul><ul><li><modelVersion>4.0.0</modelVersion> </li></ul><ul><li><groupId> com.example </groupId> </li></ul><ul><li><artifactId> my-app </artifactId> </li></ul><ul><li><version>1.0-SNAPSHOT</version> </li></ul><ul><li></project> </li></ul>No source or target defined in POM, yet this works: $ mvn compile
  33. 33. Super POM <ul><li><project> </li></ul><ul><li><build> </li></ul><ul><li>... </li></ul><ul><li><outputDirectory> target/classes </outputDirectory> </li></ul><ul><li>... </li></ul><ul><li><sourceDirectory> src/main/java </sourceDirectory> </li></ul><ul><li>... </li></ul><ul><li><resources> </li></ul><ul><li><resource> </li></ul><ul><li><directory> src/main/resources </directory> </li></ul><ul><li></resource> </li></ul><ul><li></resources> </li></ul><ul><li>... </li></ul><ul><li></build> </li></ul><ul><li></project> </li></ul>To fully resolve the POM: $ mvn help:effective-pom | less
  34. 34. POM Inheritance <ul><li><project> </li></ul><ul><li><parent> </li></ul><ul><li><groupId>com.example</groupId> </li></ul><ul><li><artifactId>org-pom</artifactId> </li></ul><ul><li><version>1</version> </li></ul><ul><li></parent> </li></ul><ul><li><groupId>com.example</groupId> </li></ul><ul><li><artifactId>my-app</artifactId> </li></ul><ul><li>... </li></ul><ul><li></project> </li></ul><project> <groupId>com.example</groupId> <artifactId>org-pom</artifactId> <version>1</version> <!-- configure JDK version, e.g: 1.5 standard reports, etc. --> </project>
  35. 35. Maven Repositories <ul><li>Repositories store artifacts: </li></ul><ul><ul><li>plugins </li></ul></ul><ul><ul><li>project dependencies </li></ul></ul><ul><li>Central: http://repo1.maven.org/maven2 (or mirror)‏ </li></ul><ul><li>Local: ~/.m2/repository </li></ul><ul><li>The first execution of a plugin, or requirement for a dependency pulls the artifact from central and caches it locally </li></ul>
  36. 36. Maven Repositories <ul><li>Problems: </li></ul><ul><li>Reliant on network and external repository for dependencies and plugins </li></ul><ul><li>Can't deploy to Central Maven repository for reuse as dependencies of other projects (though usually wouldn't want to)‏ </li></ul>
  37. 37. Organisation Repository <ul><li>No longer reliant on network or external repository for dependencies and plugins </li></ul><ul><li>Can deploy to organisation repository in order to share artifacts </li></ul><ul><li>Multiple repository configurations possible </li></ul><ul><li>Multiple repository tools available: Archiva, Proximity, Artifactory </li></ul>
  38. 38. Archiva
  39. 39. Install and Deploy <ul><li>$ mvn deploy </li></ul>
  40. 40. Install and Deploy <ul><li>$ mvn deploy </li></ul>
  41. 41. SCM Integration <ul><li>Fully implemented: </li></ul><ul><ul><li>Bazaar </li></ul></ul><ul><ul><li>CVS </li></ul></ul><ul><ul><li>Mercurial </li></ul></ul><ul><ul><li>Perforce </li></ul></ul><ul><ul><li>StarTeam </li></ul></ul><ul><ul><li>Subversion </li></ul></ul><ul><ul><li>CM Synergy </li></ul></ul><ul><li>Partially implemented: </li></ul><ul><ul><li>ClearCase </li></ul></ul><ul><ul><li>File system </li></ul></ul><ul><ul><li>Visual Source Safe </li></ul></ul>
  42. 42. Configuring SCM <ul><li><project> </li></ul><ul><li><groupId>com.example</groupId> </li></ul><ul><li><artifactId>my-app</artifactId> </li></ul><ul><li>... </li></ul><ul><li><scm> </li></ul><ul><li><connection> </li></ul><ul><li>scm:svn:http://example.com/svn-read/my-app/trunk </li></ul><ul><li></connection> </li></ul><ul><li><developerConnection> </li></ul><ul><li>scm:svn:http://example.com/svn-dev/my-app/trunk </li></ul><ul><li></developerConnection> </li></ul><ul><li><url> </li></ul><ul><li>http://example.com/view.cvs </li></ul><ul><li></url> </li></ul><ul><li></scm> </li></ul><ul><li></project> </li></ul>
  43. 43. SCM Integration, What For? <ul><li>Use SCM agnostic commands: $ mvn scm:checkin -Dmessage=&quot;to the cause&quot; $ mvn scm:update </li></ul><ul><li>Project bootstrapping: $ mvn scm:bootstrap </li></ul><ul><li>Available for use by Maven tools, e.g: documented and linked in project website, published in Archiva summary </li></ul><ul><li>Continuous Integration, SCM details located in project rather than CI tool </li></ul><ul><li>Release management </li></ul>
  44. 44. Cutting a Release <ul><li>$ mvn release:prepare [-DdryRun=true] </li></ul><ul><li>Checks SCM for modifications </li></ul><ul><li>Checks for use of SNAPSHOT dependencies or plugins </li></ul><ul><li>Runs $ mvn clean integration-test </li></ul><ul><li>Requests release info: </li></ul><ul><ul><li>version numbers </li></ul></ul><ul><li>Creates new POMs: </li></ul><ul><ul><li>pom.xml for tag </li></ul></ul><ul><ul><li>pom.xml for next version </li></ul></ul><ul><ul><li>release-pom.xml </li></ul></ul><ul><li>Creates tag in SCM </li></ul><ul><li>$ mvn release:perform </li></ul><ul><li>Uses release-pom.xml, deploys project, generates site, etc. </li></ul>
  45. 45. Website / Reports (1)‏ <ul><li>Project website: </li></ul><ul><ul><li>Conventions for structuring documentation, supporting various formats: DocBook simple, FML, XDOC, APT, Twiki </li></ul></ul><ul><ul><li>Directory structure conventions, supporting multiple types of documentation, e.g: public, user, developer, etc. </li></ul></ul><ul><ul><li>Configurable, skinnable site </li></ul></ul><ul><ul><li>Project info from POM: contact details: organisation, developers; SCM details, etc. </li></ul></ul>
  46. 46. Website / Reports (2)‏ <ul><li>Metrics, checks, and project reports (on website): </li></ul><ul><ul><li>Javadoc </li></ul></ul><ul><ul><li>Test results </li></ul></ul><ul><ul><li>Code coverage (Cobertura)‏ </li></ul></ul><ul><ul><li>Checkstyle, PMD, JDepend, Clirr </li></ul></ul><ul><ul><li>Database documentation (Hibernate)‏ </li></ul></ul><ul><ul><li>Dependency report </li></ul></ul><ul><ul><li>TODO report (//TODO, FIXME, configurable)‏ </li></ul></ul><ul><ul><li>Linked and line-numbered HTML sources </li></ul></ul><ul><ul><li>Release notes and roadmap from issue tracker </li></ul></ul>
  47. 47. Quick Tour
  48. 48. In Brief (1)‏ <ul><li>Java EE support: </li></ul><ul><ul><li>WAR, EAR packaging </li></ul></ul><ul><ul><li>Rapid web app development </li></ul></ul><ul><ul><li>Integration (in container) testing </li></ul></ul><ul><ul><li>Deployment to environments </li></ul></ul><ul><li>Multi-module projects </li></ul><ul><ul><li>Enable / encourage reuse between projects </li></ul></ul><ul><ul><li>Maven inter-module dependency eliminates cycles between modules </li></ul></ul><ul><ul><li>Nicely supported in NetBeans </li></ul></ul><ul><ul><li>Not nicely supported in Eclipse – nested projects </li></ul></ul>
  49. 49. In Brief (2)‏ <ul><li>Continuous Integration: </li></ul><ul><ul><li>CruiseControl </li></ul></ul><ul><ul><li>Continuum </li></ul></ul><ul><ul><ul><li>Reuses project information as defined in POM </li></ul></ul></ul><ul><li>Profiles </li></ul><ul><ul><li>Build activity carried out under different conditions, e.g: personal requirements, dev / test / release, continuous integration </li></ul></ul><ul><li>Maven settings </li></ul><ul><li>Help </li></ul>
  50. 50. Problems <ul><li>History: Maven 1, might have left a bad taste </li></ul><ul><li>Steep learning curve </li></ul><ul><ul><li>Once you've got it, the knowledge is portable to other projects built with Maven </li></ul></ul><ul><li>Complex needs require complex configuration </li></ul><ul><ul><li>Alan Kay: Simple things should be simple. Complex things should be possible </li></ul></ul><ul><li>Verbose XML config </li></ul><ul><li>Docs aren't great, but getting better </li></ul><ul><li>Error messages often do not provide much (or any) detail (e.g. archetype problem)‏ </li></ul><ul><li>Ensuring the project is buildable and testable in the IDE as well as with Maven can be complex </li></ul><ul><li>Multi-module projects not supported by Eclipse (but they are in Netbeans)‏ </li></ul>
  51. 51. Stuff to Look at <ul><li>Buildr – a build system configured in Ruby that reuses parts of Maven: </li></ul><ul><ul><li>repositories; </li></ul></ul><ul><ul><li>directory structure conventions; </li></ul></ul><ul><li>Rake – a Ruby build tool </li></ul>
  52. 52. Still Interested? <ul><li>Get reading and enjoy the ride </li></ul>
  53. 53. Questions?
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×