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:
    How to do it...
  2. Choose the project we created in the previous chapter:
    How to do it...
  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 adds them to the project dependencies.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.235.176