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.

Maven Overview January 2008

648 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Maven Overview January 2008

  1. 1. Maven Overview Great West Life Scott Ryan Soaring Eagle, LLC January 29, 2008
  2. 2. Agenda <ul><ul><li>What is Maven? </li></ul></ul><ul><ul><li>Projects and the project model </li></ul></ul><ul><ul><li>XML Configuration files </li></ul></ul><ul><ul><li>Repositories </li></ul></ul><ul><ul><li>Plug-ins </li></ul></ul><ul><ul><li>Reporting </li></ul></ul><ul><ul><li>Automated Builds and Quality Control </li></ul></ul><ul><ul><li>Release Management </li></ul></ul>
  3. 3. What is Maven <ul><ul><li>A Build System </li></ul></ul><ul><ul><li>Favors convention over configuration or customization </li></ul></ul><ul><ul><li>Supports standardized artifact management and auditing </li></ul></ul><ul><ul><li>Supports reporting, code quality and automated builds </li></ul></ul><ul><ul><li>Supports release automation </li></ul></ul><ul><ul><li>Used by very large enterprises </li></ul></ul><ul><ul><li>Has a well defined life-cycle </li></ul></ul>
  4. 4. Sample Life-cycle <ul><ul><li>validate </li></ul></ul><ul><ul><li>compile </li></ul></ul><ul><ul><li>test </li></ul></ul><ul><ul><li>package </li></ul></ul><ul><ul><li>integration test </li></ul></ul><ul><ul><li>verify </li></ul></ul><ul><ul><li>install </li></ul></ul><ul><ul><li>deploy </li></ul></ul>
  5. 5. Repositories <ul><ul><li>Multi-level repository model </li></ul></ul><ul><ul><ul><li>Increases performance </li></ul></ul></ul><ul><ul><ul><li>Insures consistency between all builds in an enterprise </li></ul></ul></ul><ul><ul><ul><li>Enables granular security </li></ul></ul></ul><ul><ul><ul><li>Enables quick project jump-start and enrichment </li></ul></ul></ul>
  6. 6. Repository Diagram Project A Repository Local Repository Enterprise/Proxy Repository Project B Repository Commercial Repository Remote Repository Remote Repository Remote Repository
  7. 7. Projects and the Project Model <ul><ul><li>Project structure is important </li></ul></ul><ul><ul><li>Project definition is controlled by the Project POM </li></ul></ul><ul><ul><li>Maven encourages a best practice model but supports almost any model </li></ul></ul><ul><ul><li>Project isolates components such as test and delivery resources to ease packaging and increase security </li></ul></ul><ul><ul><li>Following the default project structure eases the use of plug-ins and standard reporting </li></ul></ul>
  8. 8. Project Layout <ul><ul><li>See Demo </li></ul></ul>
  9. 9. XML Configuration Files <ul><ul><li>settings.xml </li></ul></ul><ul><ul><ul><li>Unique Schema </li></ul></ul></ul><ul><ul><ul><li>Supports cross project configuration </li></ul></ul></ul><ul><ul><li>pom.xml </li></ul></ul><ul><ul><ul><li>Unique Schema </li></ul></ul></ul><ul><ul><ul><li>Describes the structure of a project </li></ul></ul></ul><ul><ul><ul><li>Can be logically or physically hierarchical or both </li></ul></ul></ul><ul><ul><ul><li>Controls the behavior of the maven system </li></ul></ul></ul><ul><ul><ul><li>Allows for transitive dependency resolution </li></ul></ul></ul><ul><ul><ul><li>The mother or master pom is the parent of all poms </li></ul></ul></ul>
  10. 10. Suggested Structure <ul><ul><li>settings.xml </li></ul></ul><ul><ul><ul><li>repository definition </li></ul></ul></ul><ul><ul><ul><li>server security information for deployment </li></ul></ul></ul><ul><ul><ul><li>local repository location information </li></ul></ul></ul><ul><ul><li>Enterprise Pom </li></ul></ul><ul><ul><ul><li>Common plug-in definitions </li></ul></ul></ul><ul><ul><ul><li>Common profiles </li></ul></ul></ul><ul><ul><ul><li>Dependency definitions </li></ul></ul></ul><ul><ul><ul><li>Common reports </li></ul></ul></ul><ul><ul><ul><li>Site configuration information </li></ul></ul></ul>
  11. 11. Suggested Structure (2) () <ul><ul><li>Project Pom </li></ul></ul><ul><ul><ul><li>Dependency version information </li></ul></ul></ul><ul><ul><ul><li>Project version information </li></ul></ul></ul><ul><ul><ul><li>Common properties </li></ul></ul></ul><ul><ul><ul><li>Common profile information </li></ul></ul></ul><ul><ul><ul><li>Module definitions </li></ul></ul></ul><ul><ul><li>Module Pom </li></ul></ul><ul><ul><ul><li>Specific module dependencies </li></ul></ul></ul><ul><ul><ul><li>Module type information (jar, etc) </li></ul></ul></ul><ul><ul><ul><li>Module resource definitions </li></ul></ul></ul><ul><ul><ul><li>Specific profile information </li></ul></ul></ul><ul><ul><ul><li>Module properties </li></ul></ul></ul>
  12. 12. Project Creation mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-jsf -DremoteRepositories= http://static.appfuse.org/releases -DarchetypeVersion=2.0.1 -DgroupId=com.mycompany.app -DartifactId=myproject
  13. 13. settings.xml <settings> <servers> <server> <id>codehaus.org</id> <username>guessme</username> <password>guessme</password> </server> </servers> PROFILE SECTION GOES HERE. SEE NEXT SLIDE <activeProfiles> <activeProfile>dev</activeProfile> </activeProfiles> <pluginGroups> <pluginGroup>org.appfuse</pluginGroup> <pluginGroup>org.codehaus.mojo</pluginGroup> </pluginGroups> </settings>
  14. 14. settings.xml(2) <profiles> <profile> <id>dev</id> <repositories> <repository> <id>Codehaus Snapshots</id> <url>http://snapshots.repository.codehau s.org /</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>false</enabled> </releases> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>Codehaus Snapshots</id> <url>http://snapshots.repository.codehau s.org /</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>false</enabled> </releases> </pluginRepository> </pluginRepositories> </profile> </profiles>
  15. 15. pom.xml <ul><ul><li>See text file </li></ul></ul><ul><ul><ul><li>Discuss dependencies </li></ul></ul></ul><ul><ul><ul><li>Discuss Plugin configuration </li></ul></ul></ul><ul><ul><ul><li>Discuss properties </li></ul></ul></ul>
  16. 16. Profiles <ul><ul><li>Allow custom configuration </li></ul></ul><ul><ul><li>Triggered by build flags </li></ul></ul><ul><ul><li>Use should be minimized to lower impact on SOX compliance </li></ul></ul><ul><ul><li>Can be used for environment specific configuration </li></ul></ul><ul><ul><li>Can be combined in one build and are assembled in order </li></ul></ul>
  17. 17. Profile Sample <profile> <id>jboss</id> <!-- Add el-api dependency since JBoss 4.0.5 uses Tomcat 5.5.x and JBoss 4.2.0 doesn't work with Cargo --> <dependencies> <dependency> <groupId>javax.el</groupId> <artifactId>el-api</artifactId> <version>${el.version}</version> </dependency> </dependencies> <properties> <cargo.container>jboss4x</cargo.container> <cargo.container.home>${env.JBOSS_HOME}</cargo.container.home> <cargo.container.url> http://easynews.dl.sourceforge.net/sourceforge/jboss/jboss-4.0.5.GA.zip </cargo.container.url> </properties> </profile>
  18. 18. Resources <ul><ul><li>Resources are assembled during the build </li></ul></ul><ul><ul><li>Resources can be configured using profiles </li></ul></ul><ul><ul><li>Resources can use the replacement process </li></ul></ul><ul><ul><li>Alteration of resources should be discouraged due to SOX compliance </li></ul></ul><ul><ul><li>Location and destination of resources files is life-cycle and plug-in dependent </li></ul></ul><ul><ul><li>Configured via the pom </li></ul></ul>
  19. 19. Plug-ins(Mojo’s) <ul><ul><li>Plug-ins modify or enhance the behavior of the Maven system </li></ul></ul><ul><ul><li>Plug-ins are external to the maven system </li></ul></ul><ul><ul><li>Plug-ins can be written in many languages but are usually provided by outside parties </li></ul></ul><ul><ul><li>Plug-ins align with the life-cycle </li></ul></ul><ul><ul><li>Plug-ins can be configured in the settings.xml and the pom.xml </li></ul></ul><ul><ul><li>Maven is build primarily of plug-ins </li></ul></ul>
  20. 20. Plug-ins <ul><ul><li>Java (war, ejc, ear, rar, etc.) </li></ul></ul><ul><ul><li>Assembly </li></ul></ul><ul><ul><li>IDE (Eclipse, Intelli-J, NetBeans) </li></ul></ul><ul><ul><li>SCM (CVS, SVN, PCVS, Perforce, etc.) </li></ul></ul><ul><ul><li>Code Quality (Checkstyle, PMD, Findbugs, JDepend, SCM) </li></ul></ul><ul><ul><li>Deployment (Weblogic, Tomcat, Jetty) </li></ul></ul><ul><ul><li>Testing (JUnit, Cobertura) </li></ul></ul><ul><ul><li>Generation (XDoclet, Hibernate, Castor, XMLBeans) </li></ul></ul>
  21. 21. Reporting <ul><ul><li>Report generation is supported via plug-ins </li></ul></ul><ul><ul><li>Maven generates a standalone site for report organization </li></ul></ul><ul><ul><li>Sites follow a standard layout but is highly customizable </li></ul></ul><ul><ul><li>Maven supplies many core reports </li></ul></ul>
  22. 22. Report Samples <ul><ul><li>See live Demo </li></ul></ul>
  23. 23. Automated Builds <ul><ul><li>Maven offers easy integration with standard build systems </li></ul></ul><ul><ul><ul><li>Continuum </li></ul></ul></ul><ul><ul><ul><li>Cruise Control </li></ul></ul></ul><ul><ul><ul><li>Anthill </li></ul></ul></ul><ul><ul><li>Maven eases the addition of new projects by its consistency </li></ul></ul>
  24. 24. Release Management <ul><ul><li>Maven provides consistent predictable low impact release management </li></ul></ul><ul><ul><li>This process insures a repeatable process with high likelihood of success </li></ul></ul><ul><ul><li>Process is highly automated and mostly hands off </li></ul></ul><ul><ul><li>Output is a file describing the exact process and hot to recreate that process without manual intervention </li></ul></ul><ul><ul><li>Support checkpoint restarts </li></ul></ul><ul><ul><li>Great for SOX compliance </li></ul></ul>
  25. 25. Release (Prepare) <ul><ul><li>Check for snapshot dependencies </li></ul></ul><ul><ul><li>Check for SCM updates and missed checkins </li></ul></ul><ul><ul><li>Build and test the latest code </li></ul></ul><ul><ul><li>Update and commit poms to reflect new release </li></ul></ul><ul><ul><li>Create SCM branch </li></ul></ul><ul><ul><li>Update and commit poms to reflect new snapshot </li></ul></ul><ul><ul><li>Output file to recreate build with new branch </li></ul></ul>
  26. 26. Release (Perform) <ul><ul><li>Leverages file created in prepare step </li></ul></ul><ul><ul><li>Obtains code from the branch to a new directory </li></ul></ul><ul><ul><li>Builds with proper flags or additional flags </li></ul></ul><ul><ul><li>Installs or deploys artifacts to proper repositories </li></ul></ul><ul><ul><li>Updates site information is desired </li></ul></ul><ul><ul><li>Destroys the build file when successful (Make a backup) </li></ul></ul>

×