1

Context

I've a Eclipse Java Workspace with several projects and I must compile it. To compile each project I set specific run configuration Run As > Run Configurations... > Maven Build

Problem

I'm expense a lot of time building my projects on Eclipse. To build the projects, I use a different Base Directory for each project, because that I must build one by one and set the specific Base Directory.

Solution

Have a way to do it at one time (Build all projects with yours respective Base Directories) by script, Eclipse config. or other option?

Augusto
  • 3,825
  • 9
  • 45
  • 93
  • If you want, you can create a parent maven project and all other project as children, you can build by running the parent pom.xml and all other projects will be built automatically. This is the way if I have understood your question. – Sambit May 03 '19 at 20:31
  • Are each project independent or inter linked ? – Sachin May 03 '19 at 20:31
  • @Sachin both.... same projects are linked. – Augusto May 03 '19 at 20:33
  • @Sambit I don't want make changes. – Augusto May 03 '19 at 20:33
  • If your projects are related or part of whole project you can look at Maven Multi-module project. One another alternate choice is to write custom .bat script(for windows) which will simply call `mvn clean install` for respective modules. You can refer to : https://stackoverflow.com/questions/6130312/execute-multiple-maven-project-from-ms-bat-file – Sachin May 04 '19 at 05:30
  • 2
    You can use a [_Launch Group_](https://stackoverflow.com/a/47302032/6505250) for that. – howlger May 04 '19 at 08:22
  • @howlger on this way, I need create a new `maven configuration` for each project? – Augusto May 06 '19 at 11:59
  • 1
    @Augusto Yes, a _Launch Group_ is a container to run other launch configurations sequentially or in parallel. If you want something more generic, how about an Ant or batch/shell script? – howlger May 06 '19 at 12:14
  • @howlger I didn´t know these potions yet, but I will learn about it, apparentely a ant or script is the best way for my case. – Augusto May 06 '19 at 12:18
  • @Augusto To create an Ant script, create somewhere a file `build.xml`, use the content assist (Ctrl+Space) to get a _Buildfile template_, fill the template with your commands, save it, right-click and choose _Run As > Ant Build_. – howlger May 06 '19 at 12:28

0 Answers0