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.
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.
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.
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:
This will ask the m2 plugin to refresh the project's configuration, based on its POM.