Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import Maven multi-module project into Eclipse

How do I properly import a Maven multi-module project into Eclipse? When I import a new Maven project and select the parent pom, I can see the submodules under the parent pom which are visible in the package explorer and project explorer. However, they are presented as a deep directory structure, as if Eclipse doesn't know they are Java projects.

When I expand the submodule project, I don't see the Java package shortcuts as I would have if I opened a single Maven project. I only see it as a deep directory structure. How do I import a multimodule Maven project and open the submodule project to take advantage of Eclipse Java project features?

like image 391
Tuomas Toivonen Avatar asked Sep 02 '17 08:09

Tuomas Toivonen


1 Answers

  • Install M2E Plugin from Market if it is not already installed
  • From Eclipse IDE choose "File" and "Import" from toolbar. That should lead you to a pop up.
  • Type "Existing Maven Project", or navigate to this under Maven settings.
  • Then select the main pom project from the import menu, and be sure to select entire tree of projects under it.

Before approaching this clean the IDE from the currently wrong imported project, deleting its Maven root pom project and every submodule, but leave them on the disk obviously. I don't recommend the "Convert" options as sometimes that doesn't lead to clean results, especially with big and messy projects.

like image 91
Black.Jack Avatar answered Sep 17 '22 14:09

Black.Jack