[英]Spring boot run multiple applications
I have one project with multiple modules, every module itself is spring boot application. 我有一个包含多个模块的项目,每个模块本身都是spring boot应用程序。 I need to run all this applications with one command(using .bat for windows OR one maven run), how can I do it?
我需要使用一个命令运行所有这些应用程序(使用.bat for windows或一个maven运行),我该怎么办?
Project structure looking like this: 项目结构如下:
/base-app
/auth-service
/pom.xml - child pom
/eureka-service
/pom.xml
/zuul-service
/pom.xml
pom.xml - main pom
I can't understand at all how to do it with maven. 我根本无法理解如何用maven做到这一点。 But I tried to do it with .bat file like this:
但我尝试用.bat文件这样做:
call mvn -f eureka-service/pom.xml spring-boot:run
call mvn -f zuul/pom.xml spring-boot:run
First "call" worked fine, but second one was ignored. 第一个“通话”工作正常,但第二个被忽略了。
I need this to fast start all my services. 我需要这个来快速启动我的所有服务。
This smells monolith all over. 这种气味遍布各地。 I can't really justify use of a parent pom, in a microservice world (arguable).
在微服务世界中,我无法证明使用父pom是合理的(可论证)。 This is just my honest opinion, your scenario might be totally different.
这只是我的诚实意见,您的情况可能完全不同。
That being said, I believe, each of the child projects (auth-service,euraka and zuul) are creating it's own artifacts (jars). 话虽如此,我相信,每个子项目(auth-service,euraka和zuul)都在创建它自己的工件(罐子)。 If yes, you can just do
java -jar
on each of that in your .bat or shell commands. 如果是,您可以在.bat或shell命令中的每一个上执行
java -jar
。
If you run each of your services in a separate Docker container, Docker Compose will do what you're looking for and bring up all the services in their containers in one command with: 如果您在一个单独的Docker容器中运行每个服务,Docker Compose将执行您正在寻找的内容,并在一个命令中显示其容器中的所有服务:
docker-compose up
See https://docs.docker.com/compose/ 请参阅https://docs.docker.com/compose/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.