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:
- Navigate to File | Import… and click on Maven:
- Choose the project we created in the previous chapter:
- 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...