O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Maven for Eclipse

Book Description

A fast-paced guide that helps you create a continuous delivery solution by integrating Maven with an Eclipse environment

In Detail

Starting with an exploration of the Maven architecture and its installation, you will then learn how to install m2eclipse, which provides Maven integration with Eclipse. Furthermore, the book guides you through the stages of project creation, including building, testing, and executing the projects.

You will learn to customize your projects by demonstrating different core concepts of the Maven project structure. Nevertheless, you will also become familiar with the build lifecycles that generate the required artifacts. Moreover, it will also guide you through the process of handling multimodule projects and working with them effectively.

By the end of this book, you will have a good understanding of m2eclipse and will be able to use it efficiently with ease.

What You Will Learn

  • Install Maven and m2eclipse
  • Get to grips with the Maven architecture and the core concepts of Maven
  • Understand the Maven project structure and build lifecycle
  • Create Maven projects with and without archetypes
  • Unit tests and generate reports in different formats
  • Customize Maven to fit your needs by adding various dependencies and resources
  • Make, build, and execute multimodule projects
  • Explore the m2eclipse plugin and how it can be customized

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Maven for Eclipse
    1. Table of Contents
    2. Maven for Eclipse
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Apache Maven – Introduction and Installation
      1. Introduction to Maven
        1. Maven's origin
        2. Maven's principles
        3. Maven's component architecture
          1. The Plexus container
          2. Wagon
          3. Maven Doxia
          4. Modello
          5. Maven SCM
      2. Maven versus Ant
      3. Downloading Maven
      4. Installing Maven
        1. Installing Maven on Windows
        2. Installing Maven on Linux and Mac OS
          1. Verifying the installation of Maven
      5. Summary
    9. 2. Installing m2eclipse
      1. Introduction to m2eclipse
      2. Downloading Eclipse
      3. Installing and launching Eclipse
        1. Methods to install m2eclipse
          1. Using Eclipse Marketplace
          2. Using Update Site
      4. Setting up Maven for use
      5. Summary
    10. 3. Creating and Importing Projects
      1. The Maven project structure
      2. POM (Project Object Model)
        1. Maven coordinates
        2. POM relationships
        3. A simple POM
        4. A super POM
      3. The Maven project build architecture
      4. Other essential concepts
        1. Repository
          1. The local repository
          2. The central repository
          3. The remote repository
          4. Search sequence in repositories
        2. Project dependencies
          1. Dependency scopes
          2. Transitive dependencies
        3. Plugins and goals
        4. Site generation and reporting
      5. Creating a Maven project
        1. Using an archetype
        2. Using no archetypes
        3. Checking out a Maven project
      6. Importing a Maven project
      7. Summary
    11. 4. Building and Running a Project
      1. The build lifecycle
        1. The default lifecycle
        2. The clean lifecycle
        3. The site lifecycle
      2. The package-specific lifecycle
      3. The Maven console
      4. Building and packaging projects
      5. Running hello-project
      6. Summary
    12. 5. Spicing Up a Maven Project
      1. Creating the MyDistance project
      2. Changing the project information
      3. Adding dependencies
      4. Adding resources
      5. The application code
        1. Adding a form to get an input
        2. Adding a servlet
        3. Adding a utility class
      6. Running an application
      7. Writing unit tests
      8. Running unit tests
      9. Generating site documentation
      10. Generating unit tests – HTML reports
      11. Generating javadocs
      12. Summary
    13. 6. Creating a Multimodule Project
      1. Introduction
      2. Creating a parent project – POM
      3. Creating a core module
      4. Creating a webapp module
      5. Building a multimodule project
      6. Running the application
      7. Summary
    14. 7. Peeking into m2eclipse
      1. Other features in m2eclipse
        1. Add Dependency
        2. Add Plugin
        3. New Maven Module Project
        4. Download JavaDoc
        5. Download Source
        6. Open Javadoc
        7. Open POM
        8. Update Project
        9. Disable Workspace Resolution
        10. Disable Maven Nature
        11. Import Project(s) from SCM
      2. A form-based POM editor
        1. An overview
      3. Analyzing project dependencies
      4. Working with repositories
        1. Local Repositories
        2. Global Repositories
        3. Project Repositories
      5. m2eclipse preferences
        1. Maven
        2. Discovery
        3. Archetypes
        4. User Interface and User Settings
        5. Installations
        6. Warnings
        7. Templates
        8. Lifecycle Mappings
      6. Summary
    15. Index