简体   繁体   English

如何将现有的Maven项目作为模块添加到另一个Maven项目?

[英]How to add an existing maven project to another maven project as a module?

I have a maven project which needs to be a module for another maven project. 我有一个Maven项目,它需要是另一个Maven项目的模块。 Is there a way to achieve this in eclipse or from the cli? 有没有办法在日食或cli中实现这一目标? I added the 我添加了

 <module>existing_maven_proj</module> 

in the POM of the parent project and ran maven install but this doesn't seem to add the module 在父项目的POM中并运行maven install,但这似乎没有添加模块

If you use M2e with Eclipse you do not need to do that, because Eclipse resolves dependencies across the workspace. 如果将M2e与Eclipse一起使用,则不需要这样做,因为Eclipse可以解决整个工作区中的依赖关系。 You just need to have the two projects open and your dependencies declared correctly. 您只需要打开两个项目并正确声明依赖项即可。

If I understand you correctly, you want to update the internal Eclipse configuration for the updated maven project structure. 如果我对您的理解正确,那么您想为更新的maven项目结构更新内部Eclipse配置。 Run

mvn eclipse:eclipse

in you maven top level module. 在您的Maven顶层模块中。 You might also need to import the new maven module. 您可能还需要导入新的Maven模块。 Just do a regular "Import existing maven project into workspace" to get this done. 只需执行常规的“将现有的Maven项目导入工作区”即可完成此操作。

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

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