Book Image

Apache Maven Cookbook

Book Image

Apache Maven Cookbook

Overview of this book

Table of Contents (18 chapters)
Apache Maven Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Importing an existing Maven project in Eclipse


If you have already set up a Maven project from the command-line, then it can easily be imported to Eclipse.

If you have not yet set up Eclipse and verified that Maven exists, please follow the Getting ready section of the preceding recipe.

How to do it...

To import an existing Maven project in Eclipse, perform the following steps:

  1. Navigate to File | Import… and click on Maven:

  2. Choose the project we created in the previous chapter:

  3. Import the project. You will see contents identical to what we saw when creating a new Maven project.

How it works...

Eclipse has built-in support for Maven projects. When a Maven project is imported, it parses the pom file, pom.xml, for the specified project. Based on the project's pom configuration file, it creates relevant Eclipse configurations to recognize source files, tests, and artifacts.

It also identifies all the dependencies of the project, downloads these using Maven (if they haven't been downloaded already), and...