简体   繁体   English

导入到新的Eclipse工作区时,Maven多模块不保留映射模块

[英]maven multimodule not keep the mapping module when import to new eclipse workspace

I created a maven multi-module project by using eclipse and m2eclipse plugin: First: i created a parent project by using eclipse (choose menu\\New\\Maven project), then right click on that project and click New\\Other\\MavenModule). 我使用eclipse和m2eclipse插件创建了一个maven多模块项目:首先:我使用eclipse创建了一个父项目(选择menu \\ New \\ Maven项目),然后右键单击该项目,然后单击New \\ Other \\ MavenModule。 I have 2 modules. 我有2个模块。 by using that way, on the project Explorer panel, i can see one parent project and 2 module like this: 通过这种方式,在项目资源管理器面板上,我可以看到一个父项目和两个模块,如下所示:

  - parent
         - module 1
         - module 2
  - module 1 (mapping from module 1 that stay inside parent)
  - module 2 (mapping from module 2, whatever you change here will be reflect to module 2 that stay inside parent)

I like this way, because i can treat the modules like a real eclipse project, i can right click on the module and do Clean or Build. 我喜欢这种方式,因为我可以像对待真正的Eclipse项目一样对待这些模块,因此我可以右键单击该模块并执行Clean或Build。

But now the problem happened when i create a new workspace and import the parent project into new workspace (i still using the same eclipse), the module mapping disappear. 但是现在,当我创建一个新的工作区并将父项目导入新的工作区(我仍使用相同的Eclipse)时,发生了问题,模块映射消失了。 now in the new workspace, what i can see is: 现在在新工作区中,我可以看到的是:

-parent
      - module 1
      - module 2

The new look is so inconvenient. 新外观很不方便。 i dont have availability to treat the module like the real project any more. 我不再有能力像实际项目一样对待模块。

My question is how to fix that issue? 我的问题是如何解决该问题? what i want is when import to a new workspace, the project still have the mapping modules go along with. 我想要的是,当导入到新的工作区时,该项目仍然具有映射模块。

go to workspace parent folder try running this 转到工作区父文件夹尝试运行此

    mvn eclipse:eclipse

see here what it does: http://maven.apache.org/plugins/maven-eclipse-plugin/eclipse-mojo.html 请参阅此处的功能: http : //maven.apache.org/plugins/maven-eclipse-plugin/eclipse-mojo.html

eclipse:eclipse 蚀:蚀

Full name : org.apache.maven.plugins:maven-eclipse-plugin:2.8:eclipse 全名 :org.apache.maven.plugins:maven-eclipse-plugin:2.8:eclipse

Description : Generates the following eclipse configuration files: 描述 :生成以下Ec​​lipse配置文件:

  • .project and .classpath files .project和.classpath文件
  • .setting/org.eclipse.jdt.core.prefs with project specific compiler settings .setting / org.eclipse.jdt.core.prefs与项目特定的编译器设置
  • various configuration files for WTP (Web Tools Project), if the parameter wtpversion is set to a valid version (WTP configuration is not generated by default) WTP(Web工具项目)的各种配置文件,如果参数wtpversion设置为有效版本(默认情况下不生成WTP配置)

If this goal is run on a multiproject root, dependencies between modules will be configured as direct project dependencies in Eclipse (unless useProjectReferences is set to false). 如果此目标在多项目根目录上运行,则模块之间的依赖关系将在Eclipse中配置为直接项目依赖关系 (除非useProjectReferences设置为false)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM