Maven Nexus

2,937 views
2,759 views

Published on

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,937
On SlideShare
0
From Embeds
0
Number of Embeds
96
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Maven Nexus

  1. 1. Sonatype Nexus and Maven Basics<br />February 9, 2010<br />
  2. 2. 2<br />Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project&apos;s build, reporting and documentation from a central piece of information. <br />What is Maven<br />
  3. 3. 3<br />Problems Addressed and Uses for Maven<br /><ul><li>Large software projects usually contain tens or even hundreds of projects/modules
  4. 4. Will become messy and incomprehensible if the projects don’t adhere to some common principles
  5. 5. Will be time-consuming to build all projects manually</li></ul>Use a project management tool (like Maven)<br />Maven helps you with various aspects:<br />Build process<br />Project structure<br />Dependency management<br />Access to information and documentation<br />
  6. 6. 4<br />Build process<br />The Project Object Model (POM) – an XML file – is the heart of a Maven 2 project<br /><ul><li>Contains project information and configuration details used to build the project
  7. 7. Project dependencies
  8. 8. Commands (goals) that can be executed
  9. 9. Plugins
  10. 10. Metadata
  11. 11. The POM extends the Super POM</li></li></ul><li>5<br />POM - Simple example<br />
  12. 12. 6<br />POM – Project inheritance<br />
  13. 13. 7<br />POM – Project aggregation<br />
  14. 14. 8<br />The build lifecycle is the process of building and distributing an artifact<br />A phase is a step in the build lifecycle<br />Most important default phases:<br />Validate<br />Compile<br />Test<br />Package<br />Install<br />Deploy<br />Some common phases not default:<br />Clean<br />Site<br />For each step, all previous steps are executed<br />Build Lifecycle and Phases<br />
  15. 15. 9<br />Advantages:<br />A developer familar with Maven will quickly get familiar with a new project<br />No time wasted on re-inventing directory structures and conventions<br />src/main/java Javasource files goes here<br />src/main/resources Other resources your application needs<br />src/main/filters Resource filters (properties files)<br />src/main/config Configuration files<br />src/main/webapp Web application directory for a WAR project<br />src/test/java Test sources like unit tests (not deployed)<br />src/test/resources Test resources (not deployed)<br />src/test/filters Test resource filter files (not deployed)<br />src/site Files used to generate the Maven project website<br />Standard directory layout<br />
  16. 16. 10<br />Dependency: a third-party or project-local software library (JAR or WAR file)<br />Dependency management is a challenge in multi-module projects<br />Dependency management<br />
  17. 17. 11<br />Dependency management<br />
  18. 18. 12<br />Dependency management<br />
  19. 19. 13<br />Repositories<br />
  20. 20. 14<br />Repositories<br />
  21. 21. 15<br />Most projects use open source software as building blocks in application development. These building blocks, referred to as Artifacts, are best obtained from Maven repositories, because these repositories store binary artifacts together with meta data to describe dependencies, licensing and locations of source code. To control what artifacts are acquired, to manage local repositories and to support their software development work-flows and policies, companies use an Artifact Repository Manager such as Nexus Open Source or Nexus Professional.<br />Sonatype Nexus - Artifact Repository Managers<br />
  22. 22. 16<br />Proxy Repository: A proxy repository is a proxy of a remote repository. <br />Hosted Repository: A hosted repository is a repository which is hosted by Nexus. <br />Virtual Repository: This serves as an adapter to and from different types of repositories. Currently Nexus supports conversion to and from Maven 1 repositories and Maven 2 repositories. <br />Sonatype Nexus - Artifact Repository Managers<br />
  23. 23. 17<br />See Nexus Demo<br />
  24. 24. 18<br />References<br />http://www.uio.no/studier/emner/matnat/ifi/INF5750/h07/undervisningsmateriale/software_project_management_and_maven.pdf<br />http://maven.apache.org/guides/index.html<br />http://nexus.sonatype.org<br />http://www.sonatype.com/<br />http://www.sonatype.com/documentation/books (Free Online)<br />The “Maven Definitive Guide” is now Two Books<br />Maven by Example<br />Maven: The Complete Reference<br />Repository Management with Nexus<br />Developing with Eclipse and Maven<br />The Maven Handbook<br />

×