java - How to run multiple modules separately in multi-module maven project -


i have created multi-module maven project , each module spring boot application. want run each module under parent project.

for example:

parent p -- module -- src -- pom.xml -- module b --src --pom.xml --pom.xml

what doing executing mvn clean install parent pom on command prompt , navigating target folder of each module , executing each jar java - jar

i want run module first , module b in single shot. possible? how in maven.

there 2 ways come mind achieve want do:

script

write script builds , starts each module. i've included windows batch script example.

maven.bat

mvn clean package start java -jar module-a/target/module-a-0.0.1.build-snapshot.jar start java -jar module-b/target/module-b-0.0.1.build-snapshot.jar 

docker

use docker , more specifically, docker-compose start modules single command:

docker-compose 

docker-compose.yml

modulea:  image: foobar/modulea  ports:   - "8080:8080"  links:   - moduleb  environment:   - spring_profiles_active=local moduleb:  image: foobar/moduleb  ports:   - "8081:8080"  links:   - modulea  environment:   - spring_profiles_active=local 

visit links documentation more detail on how use docker & docker-compose.


Comments