在Eclipse中使用Maven构建多个项目 [英] build multiple projects using maven in eclipse

查看:69
本文介绍了在Eclipse中使用Maven构建多个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地环境中有7个项目,其中一些相互依赖.我已经按照特定的顺序构建了它们,以准备开发环境.我必须执行更新依赖性,然后为此按特定顺序在每个项目上进行全新安装.
有什么捷径可以代替手动步骤吗?如何创建运行配置(或以其他任何方式)以按一定顺序构建所有项目?

I have 7 projects in my local environment and some of them depend on each other. I have built them in a particular sequence to prepare my development environment. I have to do update dependency and then maven clean install on each project in a particular sequence for this.
Is there any shortcut to do this instead of the manual steps? How do I create a run configuration ( or any other way) to build all projects in some sequence?

-Sunil

推荐答案

如果这7个项目是整个项目的一部分,那么您需要的是

If these 7 projects are parts of a whole project then what you need is a Maven multi-module project. When you are done setting it up the directory structure will look like:

project-root
   |
   +-- project-1
   |
   +-- project-2
   .
   .
   |
   +-- project-7

另一方面,如果这些仅仅是7个其他独立项目,则您将在每个项目中建立与其他相关项目的依赖关系.

On the other hand if these are just 7 otherwise independent project you would set up dependencies in each project on other related projects.

请注意,在后一种情况下,独立项目只是因为您构建 project-x 并不意味着 project-y 将接受更改.在构建 project-x 时,必须执行 mvn install 以确保将其推送到本地Maven存储库.然后,您必须在 project-y 上运行 mvn软件包(或 mvn install ).

Be aware that in the latter case of independent projects, just because you build project-x it doesn't mean that project-y will pick up changes. When you build project-x you have to do mvn install to ensure that it gets pushed to your local Maven repository. Then you have to run mvn package (or mvn install) on project-y.

由于您使用的是Eclipse,因此我强烈建议您安装 M2Eclipse插件.它将大大简化您的Eclipse配置与POM的更改保持同步的步伐.

Since you are using Eclipse I would highly recommend installing the M2Eclipse plugin. It will greatly simplify keeping your Eclipse configuration in lock-step with any POM changes.

这篇关于在Eclipse中使用Maven构建多个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆