facebook

Creating Maven Projects

This tutorial describes how to create a web project that integrates with Maven. A simple checkbox creates a Maven-enabled project. You will also learn how to import an existing Maven project.

Maven support is available in MyEclipse.

1. Creating a Maven Project

  1. Select File>New, and select the type of project you want to create. You can add Maven support to Web, EJB, EAR, and conventional Java projects.
  2. Name the project and complete each field making sure to select the Add Maven support checkbox. Click Next until you reach the Maven Project Support page.

    newwebprojectmaven
    Adding Maven support
  3. In the Artifact section, enter the Group ID and Artifact ID. These follow typical package and project naming conventions.

    The project structure defaults to a standard MyEclipse project structure. You can choose to use the Maven project structure instead.

    newprojectmavensupport
    Adding group and artifact IDs
  4. Click Next to add additional libraries, or Finish to accept default libraries and create the project.

The Project Explorer displays all Maven dependencies, and in the pom.xml file the dependencies are outlined as XML.

mavenpomfile
Dependencies in the POM file

You can add technology facets to the Maven project in the same way that you add facets to other MyEclipse projects.

2. Importing a Maven Project

You can import an existing Maven project by selecting the root folder in which the project files reside.

  1. Select File>Import, expand Maven, select Existing Maven Projects, and click Next.

    importmavenprojectmenu
    Importing an existing maven project
  2. In the Root Directory field, browse for the Maven project root folder. The projects contained in the root appear in the Projects list.

    importmavenprojectwizard
    Specifying the project root and selecting projects to import
  3. Select all projects, or select only the ones you want to import, and click Finish.