How to combine several run configurations in IntelliJ together?

Intellij Idea

Intellij Idea Problem Overview


I have an IntelliJ project with several modules. Some of the modules should be run as servers. For every server (module), I have a run configuration.

Can I bundle those run configurations together, so I don't need to click run or stop five times?

If it matters, the project is fully mavenized.

Intellij Idea Solutions


Solution 1 - Intellij Idea

The previously accepted answer does not work for running multiple servers or any scripts which do not terminate.

The good news is that now you can use the Compound run configuration which is build natively into the program to execute multiple servers simultaneously which do not terminate.

In fact, even the MultiRun plugin states on their GitHub page that they recommend to use the Compound run configuration over their plugin.

Official IntelliJ IDEA documentation

Here's what the options looks like:

Screenshot of what the setting looks like

Steps to get it working:

  1. First create your individual run configurations
  2. Then create a new compound configuration
  3. Now choose the individual run configurations you previously set up.
  4. Finally just run your new Compound configuration.

All the individual configs will run simultaneously. Perfect for servers and other threads which do not exit!

Solution 2 - Intellij Idea

Update

This now is possible (despite the fact that the issues @CrazyCoder linked to are still open as of this date). In Intellij 12, you can "Run Another Configuration" before launch when you're in "Edit Configurations". Here's a screenshot:

Run Another Configuration

Solution 3 - Intellij Idea

Check out this Multirun plugin.

And yes, I found it following CrazyCoder's link, so props to him again!

Solution 4 - Intellij Idea

I found that 'Compound' sorted all modules alphabetically and launched them in that order. This could be a problem if there are modules with dependencies. If there is a way to override that sorting, I could not find it.

Solution 5 - Intellij Idea

I am using the paid version of IntelliJ 2020.2

I wanted a simple thing - Start my Spring Boot application and then start my Angular application. I tried the 'Run Another Configuration' way and it did not work. I faced the same issue as faced by @AxelFontaine.

The Multirun plugin solved my problem. I did have to restart the IDE twice - once to update it after plugin installed and the second time because there was an error saving some configuration. But since then its working just as expected. This is very helpful as I can work on the UI and see the changes immediately and similarly the Spring dev tools lets me change code and it reloads immediately. This plugin is very very helpful.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1207632View Question on Stackoverflow
Solution 1 - Intellij IdeaTetraDevView Answer on Stackoverflow
Solution 2 - Intellij IdeaDaniel KaplanView Answer on Stackoverflow
Solution 3 - Intellij IdeaLodovikView Answer on Stackoverflow
Solution 4 - Intellij IdeaDave PView Answer on Stackoverflow
Solution 5 - Intellij IdeasunitkatkarView Answer on Stackoverflow