Eclipse,导入maven多模块项目

时间:2023-01-13 13:22:23

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

如何将maven多模块项目正确导入eclipse?当我导入新的maven项目并选择父pom时,我可以看到父pom下的子模块,它们在包资源管理器和项目资源管理器中可见。但是,它们被呈现为深层目录结构,就好像eclipse不知道它们是java项目。

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

当我展开子模块项目时,我没有看到java包快捷方式,因为我打开了一个maven项目。我只把它看作一个深层目录结构。如何导入multimodule maven项目并打开子模块项目以利用eclipse java项目功能?

(http://i68.tinypic.com/6p3i86.png)

2 个解决方案

#1


1  

  • Install M2E Plugin from Market if it is not already installed
  • 如果尚未安装,请从Market安装M2E插件

  • From Eclipse IDE choose "File" and "Import" from toolbar. That should lead you to a pop up.
  • 从Eclipse IDE中选择工具栏中的“文件”和“导入”。这会导致你弹出一个。

  • Type "Existing Maven Project", or navigate to this voice under Maven settings.
  • 键入“Existing Maven Project”,或在Maven设置下导航到此语音。

  • Then select main pom project from the import menu, and be sure to select entire tree of projects under it.
  • 然后从导入菜单中选择主pom项目,并确保选择其下的整个项目树。

Before to approach this clean the IDE from current wrong imported project deleting its maven root pom project and every sub modules, but leave them in the disk obviously. I don't recommend the "Convert" options as sometimes doesn't lead to clean results, especially with big and messy projects. That should do the trick. Let me know if this solves your problem.

在接近此之前,从当前错误导入的项目中删除IDE,删除其maven root pom项目和每个子模块,但显然将它们留在磁盘中。我不建议使用“转换”选项,因为有时不会导致干净的结果,特别是对于大而混乱的项目。这应该够了吧。如果这可以解决您的问题,请告诉我。

#2


-2  

Follow the steps

按照步骤

  1. Choose file menu
  2. 选择文件菜单

  3. Click on import
  4. 点击导入

  5. Select project right click then Convert --> Convert to maven project
  6. 选择项目右键单击然后转换 - >转换为maven项目

  7. Click on import then type or select Existing Maven Project
  8. 单击导入,然后键入或选择现有Maven项目

Now your moduled project in you workbench. If you have any query we can discuss.

现在您的工作台中的模块化项目。如果您有任何疑问,我们可以讨论。

#1


1  

  • Install M2E Plugin from Market if it is not already installed
  • 如果尚未安装,请从Market安装M2E插件

  • From Eclipse IDE choose "File" and "Import" from toolbar. That should lead you to a pop up.
  • 从Eclipse IDE中选择工具栏中的“文件”和“导入”。这会导致你弹出一个。

  • Type "Existing Maven Project", or navigate to this voice under Maven settings.
  • 键入“Existing Maven Project”,或在Maven设置下导航到此语音。

  • Then select main pom project from the import menu, and be sure to select entire tree of projects under it.
  • 然后从导入菜单中选择主pom项目,并确保选择其下的整个项目树。

Before to approach this clean the IDE from current wrong imported project deleting its maven root pom project and every sub modules, but leave them in the disk obviously. I don't recommend the "Convert" options as sometimes doesn't lead to clean results, especially with big and messy projects. That should do the trick. Let me know if this solves your problem.

在接近此之前,从当前错误导入的项目中删除IDE,删除其maven root pom项目和每个子模块,但显然将它们留在磁盘中。我不建议使用“转换”选项,因为有时不会导致干净的结果,特别是对于大而混乱的项目。这应该够了吧。如果这可以解决您的问题,请告诉我。

#2


-2  

Follow the steps

按照步骤

  1. Choose file menu
  2. 选择文件菜单

  3. Click on import
  4. 点击导入

  5. Select project right click then Convert --> Convert to maven project
  6. 选择项目右键单击然后转换 - >转换为maven项目

  7. Click on import then type or select Existing Maven Project
  8. 单击导入,然后键入或选择现有Maven项目

Now your moduled project in you workbench. If you have any query we can discuss.

现在您的工作台中的模块化项目。如果您有任何疑问,我们可以讨论。