Importing a Maven project into Eclipse

Adding a Maven project, which already has its file structure and POM defined into Eclipse, is also easy. In this example, we'll add the bookshelf-inventory-api project into Eclipse, after having constructed it as described in Chapter 5.

To add the bookshelf-inventory-api project to Eclipse, start by launching the New Java project wizard.

Importing a Maven project into Eclipse

When you type in the name of the project (in this case, com.packtpub.felix.bookshelf-inventory-api), the wizard will detect an existing project and gray out most of the remaining options in this pane.

Importing a Maven project into Eclipse

Click Finish to import this project. The result is a Java project containing the files in the directory structure.

However, this project is not yet configured to be managed by the m2clipse plugin. To enable this feature, right-click on the project root and select the Maven -> Enable Dependency Management option.

Importing a Maven project into Eclipse

The project is now associated with the Eclipse m2clipse plugin. To make it refresh its configuration based on the existing pom.xml, right-click on the project root and select the Maven -> Update Project Configuration:

Importing a Maven project into Eclipse

This will ask the m2 plugin to refresh the project's configuration, based on its POM.

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

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