Maven 2 features

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    2 Favorites

    Maven 2 features - Presentation Transcript

    1. A Pragmatic View Presentation by Angel Ruiz Calvo
    2. Index
      • What is Maven 2?
      • What does it provide?
      • Comparison with Ant.
      • Examples.
      • Installation.
      • Conclusions.
      • References.
      • Questions.
    3. What is Maven 2?
      • Formal definition:
        • “ Maven is a project management tool which encompasses a project object model, a set of standards, a project lifecycle, a dependency management system, and logic for executing plug-in goals at defined phases in a lifecycle. When you use Maven, you describe your project using a well-defined project object model, Maven can then apply cross-cutting logic from a set of shared (or custom) plug-ins”.
      • My definition:
        • It is a project management tool that helps us in all the stages of the SDLC applying the principle of “Convention over Configuration” that simplifies many common issues involved in the development of any project.
      What is Maven 2?
    4. What does it provide?
    5. What does it provide?
      • Convention over configuration:
        • Systems, libraries, and frameworks should assume reasonable defaults without requiring unnecessary configuration to " just work ".
      • Under this premise it provides:
        • Conceptual model of a project: P.O.M.
        • Plug-in based extensibility.
        • Standard project structure
        • Standard project identification.
        • Dependency Management
        • Repository Management
        • Project initialization: Archetypes.
        • IDE Portability and Integration.
        • Project configuration (JDK compilation level, SCM, Bug tracking, mailing lists, developers …).
        • Simplify and unify the process for documentation distribution and maintenance.
    6. What does it provide?
      • Conceptual model of a project: P.O.M.
        • P.O.M. = Project Object Model.
        • Maven projects are describes using a single file called pom.xml
        • This conceptual model is described using an XMLSchema.
        • Within this P.O.M. file you can define the following project information:
          • General project info: name, artifact, …
          • Customized configuration for each SDLC step: packaging, jdk, …
          • Dependencies.
          • External tools:
            • Mailing lists.
            • S.C,M. tool.
            • Bug tracking
          • Repository configuration: usually delegated on settings.xml file
    7. What does it provide?
      • Conceptual model of a project: P.O.M.
    8. What does it provide?
      • Plug-in based extensibility
        • Maven has been designed to delegate most responsibility to a set of Maven Plugins which can affect the Maven Lifecycle and offer access to goals.
        • mvn war:war
      Plug-in name Goal
    9. What does it provide?
      • Plug-in based extensibility
        • The Maven Lifecycle.
    10. What does it provide?
      • Plug-in based extensibility
        • The real value.
      Plug-ins Core
      • Clean
      • Compiler
      • Deploy
      • Install
      • Resources
      • Site
      • Surefire
      • Verifier
      Tools
      • Ant
      • Antlr
      • Antrun
      • Archetype
      • Assembly
      • Help
      • Release
      • SCM
      • XDoclet
      • Changelog
      • Changes
      • Checkstyle
      • Clover
      • Javadocs
      • PMD
      • Surefire-reports
      Reporting
      • Cargo
      • Jaxme
      • Jetty
      • Tomcat
      • Ear
      • Ejb
      • Jar
      • Rar
      • War
      • Eclipse
      • IDEA
      Others Packaging Integration
    11. What does it provide?
      • Standard project structure :
      • Flexible.
      • Clean
      • Standard.
      • Easy to understand.
    12. What does it provide?
      • Standard project identification
        • Artifact = maven project coordinates
        • Essential for dependency management.
      <project> <modelVersion>4.0.0</modelVersion> <groupId> au.com.sra </groupId> <artifactId> sra.commons </artifactId> <version> 0.0.1-SNAPSHOT </version> </project> groupId artifactId version
    13. What does it provide?
      • Standard project identification
        • Versioning nomenclature system:
      X Y Z This identifier is used when the project is currently under active development . artifactId version Package (JAR / WAR / EAR) sra-commons - 0.0.1 - SNAPSHOT .jar
      • Bugfixes
      • Minor: fixes and adds
      • Mayor: no backward compatibility
    14. What does it provide?
      • Standard project identification
        • How can we look for artifacts: http:// www.mvnrepository.com /
    15. What does it provide?
      • Dependency Management
        • Based on maven project coordinates.
        • It also implies a new and important parameter called Dependency Scope
      <project> … <dependencies> <dependency> <groupId> au.com.sra </groupId> <artifactId> sra.commons </artifactId> <version> 0.0.1-SNAPSHOT </version> <scope> compile </scope> </dependency> … </dependencies> </project>
      • compile (default)
      • provided
      • runtime
      • test
      • system
    16. What does it provide?
      • Dependency Management
        • There are some other concepts regarding dependency management:
          • Transitive dependencies:
          • Optional dependencies:
      • Conflict resolution and dependency exclusion:
      • Dependency version range:
      • Multi-module projects:
      Dependency A Dependency B Dependency C
    17. What does it provide?
      • Repository Management
        • With this feature you won’t have to maintain all the libs you are using in your SCM tool and you will reference them from a single common point.
        • By default Maven uses a local repository that is fed from the Maven Central repository or any other public Maven repository on the Internet, you may have configured in your settings.xml file.
        • By default this local repository is at ${user_home}/.m2/repository , but it is configurable.
        • In order to avoid multiple internet access to download the same file and also to get faster download speed we will use a Repository Manager that acts like a proxy between our office and the public Maven repositories.
        • It also provides a good platform to have all the company releases available and well identified.
    18. What does it provide?
      • Repository Management
        • The chosen repository management tool is called NEXUS from Sonatype: http://actdec01:8081/nexus
    19. What does it provide?
      • Project initialization: Archetypes
        • An archetype is a template for a Maven project which is used by the Maven Archetype plug-in to create new projects.
        • Archetypes can also be useful within an organization that wants to encourage standards across a series of similar and related projects.
        • mvn archetype:create -DgroupId=org.apache.maven.archetypes
        • -DartifactId=maven-archetype-webapp
    20. What does it provide?
      • IDE Portability and Integration
        • Tools like Eclipse, NetBeans, and IntelliJ now have a common place to find information about a project. Before the advent of Maven, every IDE had a different way to store what was essentially a custom Project Object Model (POM). Maven has standardized this description, and while each IDE continues to maintain custom project files, they can be easily generated from the model.
        • Integration can be performed in both ways:
          • Maven plugin:
          • IDE plugin:
        • mvn eclipse:eclipse
      Built-in plug-in Built-in plug-in
    21. What does it provide?
      • Simplify and unify the process for documentation distribution and maintenance
        • Maven site plug-in + reports
    22. Comparison with Ant
    23. Comparison with Ant
      • Two complementary tools
        • Maven is definitely better for all the tasks related to the project building process.
        • Ant is better for all the rest programmatic tasks.
      Maven has conventions, it already knew where your source code was because you followed the convention. It put the bytecode in target/classes, and it produced a JAR file in target. Ant doesn't have formal conventions like a common project directory structure, you have to tell Ant exactly where to find the source and where to put the output. Informal conventions have emerged over time, but they haven't been codified into the product. Maven has a lifecycle, which you invoked when you executed mvn install. This command told Maven to execute the a series of sequence steps until it reached the lifecycle. As a side-effect of this journey through the lifecycle, Maven executed a number of default plugin goals which did things like compile and create a JAR. Ant doesn't have a lifecycle, you had to define goals and goal dependencies. You had to attach a sequence of tasks to each goal manually Maven is declarative . All you had to do was create a pom.xml file and put your source in the default directory. Maven took care of the rest. Ant is procedural , you have to tell Ant exactly hat to do and when to do it. You had to tell it to compile, then copy, then compress …
    24. Comparison with Ant
      • Comparison thorough and example to build a jar file
        • mvn package
    25. Examples
    26. Installation
    27. Installation
      • Steps to install Maven
        • Download the latest version of Maven (currently is 2.0.9).
        • Unzip the file.
        • Put the bin folder into the system path variable.
        • Execute the following command to check that the mvn command is available:
        • Download the latest settings.xml file from the SRA wiki and place it at ${user_home}/.m2
        • The repository will be at C:.m2 epository
        • You also can find this instructions at the SRA Wiki.
        • mvn -version
    28. Conclusions
    29. Conclusions
      • Do not spend too much time defining procedures that are already modeled in Maven.
      • Maven is the result of many experienced professionals.
      • Maven is unquestionably linked to the following concepts:
      methodology standarization productivity agility usability quality control
    30. References
    31. References
      • Maven portal
      • Maven: The definitive guide
      • Better builds with Maven
      • m2Eclipse plug-in
    32. Questions

    + Angel RuizAngel Ruiz, 2 years ago

    custom

    1044 views, 2 favs, 1 embeds more stats

    This presentation tries to show the main features i more

    More info about this document

    CC Attribution License

    Go to text version

    • Total Views 1044
      • 1043 on SlideShare
      • 1 from embeds
    • Comments 0
    • Favorites 2
    • Downloads 42
    Most viewed embeds
    • 1 views on http://static.slideshare.net

    more

    All embeds
    • 1 views on http://static.slideshare.net

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories