简体   繁体   中英

Is there a way to run multiple Spring Boot applications with a single Running Configuration in IntelliJ IDEA?

I have multiple spring boot applications in a single IntelliJ project. And i want to have a single button to run all of them in some order.

I know there is an option to Run Another configuration before launching the original one, so in that way the configurations can be chained.

But when i use it, it runs that Another Configuration and doesn't run the original one.

So I'm wondering if anyone met this issue and how it was resolved?

You could create a Compound run type and add all your applications in it. That way you can just run that config and all your apps will start.

Update April 2016:

Multirun Plugin says: Prefer to use built-in support starting from IntelliJIdea 15 https://www.jetbrains.com/idea/help/run-debug-configuration-compound.html

Stéphane's answer works great but if you need additional features you can install the MultiRun Plugin that will allow you to do the same as the Compound run type but with more bells and whistles.

https://plugins.jetbrains.com/plugin/7248

For instance: You can set a delay between each configuration run or run one configuration after another using the Before Launch feature.

多运行插件

See here for more info about how to setup: https://github.com/rkhmelyuk/multirun/wiki/How-to-run-configurations-with-Multirun

Update April 2018:

On the "Run configurations" combo box, click "Edit Configurations". Then uncheck "Single instance only" option. Then click "Apply".

Then you can click the button "Run" any times you want, launching a new instance each time.

IntelliJIDEA Ultimate 2018.1

Yes you can achieve this by launching a standalone java app which will spawn multiple threads per microservice and start them. You can find a sample code [here]: https://github.com/rameez4ever/springboot-demo.git

Another note to reduce ambiguity: What was called Run Dashboard in a lot of sources in the past is now called Services .

在此处输入图片说明

Yes.

Goto " Run configurations " combo box, click " Edit Configurations ". Then unchecked " Single instance only " option. Then click "Apply"

For Eureka Server:

1.Run the application without serve.port.

2.Add server.port =9999 in application.properties. Run the application.

Now browse Eureka dashboard, you will have 2 instances running.

它被称为自2018.3 起允许并行运行,而不是仅单个实例

  1. Package the application using mvn package.
  2. Go to the folder where the packaged application jar is stored
  3. Run java -jar [NAME_OF_THE_APPLICATION_JAR] --server.port=[DESIRED_PORT_NUMBER]

OR

  1. Go to the application root directory
  2. Run: mvn spring-boot:run -Drun.arguments="--server.port=[DESIRED_PORT_NUMBER]

That way you can start multiple instances of the same microservice at the same time using different port numbers.

Env :

  • IntelliJ IDEA 2021.1.3 (Ultimate Edition)

Steps :

  • Go to Run configurations combo box.
  • Click Edit Configurations... .
  • Check Allow parallel run option.
  • Click OK .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM