Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

build multiple projects using maven in eclipse

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

like image 515
Sunil Avatar asked Jun 29 '26 09:06

Sunil


1 Answers

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.

like image 72
Sri Sankaran Avatar answered Jul 02 '26 07:07

Sri Sankaran



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!