Maven m2eclipse 多模块项目

发布于 2024-08-17 23:36:45 字数 201 浏览 10 评论 0 原文

我有一个多模块 Maven 项目,目录结构是分层的。有些模块依赖于其他模块。我已将依赖模块添加到项目 POM 的依赖项部分。但是,为了解决这些依赖关系,我需要导入父项目,然后选择“Project Properties”>“Project Properties”。 Maven 并选择“启用的模块”。这是正常的吗?为什么项目不直接解析工作区中的依赖项目?

谢谢, 杰夫

I have a multi module maven project and the directory structure is hierarchical. Some modules have dependencies on others. I have added the dependent modules to the dependency section of the project's POM. However, in order to resolve those dependencies, I need to import the parent project, and select Project Properties > Maven and select "Enabled Modules." Is this normal? Why wouldn't the project just resolve the dependent project in the workspace?

thanks,
Jeff

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拧巴小姐 2024-08-24 23:36:45

但是,为了解决这些依赖关系,我需要导入父项目,然后选择“Project Properties”>“ Maven 并选择“启用的模块”。这正常吗?

不需要。导入项目时,展开高级部分,并确保选中解决工作区项目(不过这应该是默认设置)。
您还可以在项目级别更改此设置。只需右键单击项目,选择属性> Maven 并验证是否选中了解决工作区项目的依赖关系

更新:回答OP评论中提出的问题。来自https://docs.sonatype.org/display/M2ECLIPSE/Dependency+Management 关于包含模块

启用后,所有嵌套模块的依赖项都会添加到“Maven 依赖项”容器,并且在运行“更新源”操作时,嵌套模块的源文件夹会添加到当前项目构建路径。 当您将多个 Maven 项目作为单个 Eclipse 项目导入时,例如当在 项目导入向导

However, in order to resolve those dependencies, I need to import the parent project, and select Project Properties > Maven and select "Enabled Modules." Is this normal?

No. When you import your projects, unfold the Advanced part and make sure that Resolve Workspace projects is checked (that should be the default though).
You can also change this setting at the project level. Just right-click on a project, select Properties > Maven and verify that Resolve dependencies from Workspace projects is checked.

UPDATE: Answering a question asked in a comment by the OP. From https://docs.sonatype.org/display/M2ECLIPSE/Dependency+Management about Include modules:

When enabled, dependencies from all nested modules are added to the "Maven Dependencies" container and source folders from nested modules are added to the current project build path when running "Update Sources" action. This option is enabled when you import multiple Maven projects as single Eclipse project, e.g. when "Separate projects for modules" option is turned off in the project import wizards.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文