build multiple projects using maven in eclipse

折月煮酒 提交于 2021-02-08 04:42:09

问题


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


回答1:


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

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

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.

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.



来源:https://stackoverflow.com/questions/8495287/build-multiple-projects-using-maven-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!