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.

Build and Release with Maven

2,451 views

Published on

Short introduction to Maven with a focus on SCM integration and release management.

Presentation given at a Copenhagen Perl Mongers Tech Meeting on November 24 2009.

Short tutorial to supplement the slides is available here: http://slu.livejournal.com/12939.html

Published in: Technology, News & Politics

Build and Release with Maven

  1. 1. Cph.pm Tech Meet 2009-11-24 Build and Release with Maven Søren Lund (slu) [email_address]
  2. 2. The Olden Days <ul><li>C / C++ </li><ul><li>Code split in source and header files
  3. 3. Headers could include headers
  4. 4. What to compile when a header was modified? </li></ul><li>Make </li><ul><li>Makedepends
  5. 5. Imake
  6. 6. Makemakefile </li></ul></ul>
  7. 7. Java, Ant and Maven <ul><li>Foobar.java compiles into Foobar.class
  8. 8. javac *.java works – sorta
  9. 9. Apache Ant – Make Java style </li><ul><li>Procedural
  10. 10. It's ”roll your own” </li></ul><li>Maven is something complety different </li><ul><li>Declarative
  11. 11. Best Practices and Conventions </li></ul></ul>
  12. 12. Installation <ul><li>Install a JDK (set JAVA_HOME)
  13. 13. Unpack Maven (set M2_HOME)
  14. 14. Append $JAVA_HOME/bin and $M2_HOME/bin to your path
  15. 15. Local settings at $HOME/.m2/settings.xml </li></ul>
  16. 16. Creating a New Project <ul><li>Call mvn archetype:generate </li><ul><li>Answer a few questions and it...
  17. 17. ...creates a project directory
  18. 18. ...creates skeleton project
  19. 19. ...creates the POM (Project Object Model) </li></ul><li>Now try </li><ul><li>mvn compile
  20. 20. mvn package </li></ul></ul>
  21. 21. Integration with SCM <ul><li>Add SCM URL to the POM: <scm> <connection> URL </connection> <developerConnection> URL </developerConnection> </scm> </li></ul>
  22. 22. Setup a Repository <ul><li>Adding a repository: <distributionManagement> <repository> <id>repo id</id> <name>The Repository</name> <url>URL</url> </repository> </distributionManagement> </li></ul>
  23. 23. Prepare and Perform Release <ul><li>Preparing a release (from your own pc): mvn release:prepare </li><ul><li>Bumps version
  24. 24. Verifies build
  25. 25. Tags and commits to SCM </li></ul><li>Performing a release (on a build server): mvn release:perform </li><ul><li>Builds and uploads to repository </li></ul></ul>
  26. 26. References <ul><li>http://www.sonatype.com/documentation/books
  27. 27. http://maven.apache.org/
  28. 28. http://java.sun.com/ </li></ul>
  29. 29. The End

×