62

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.

5 Answers 5

89

The previously accepted answer does not work for running multiple servers or any scripts which do not terminate. However, now you can use the Compound run configuration to execute multiple non-terminating servers simultaneously. It looks like this:

Screenshot of what the setting looks like

Steps to get it working:

  1. Create the individual run configurations
  2. Create a new compound configuration
  3. Choose the desired individual run configurations.
  4. Run the new Compound configuration.
  5. Go to the intellij documentation.

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

NOTE: Even the MultiRun plugin recommends using Compound on their GitHub page. More info in the IDEA documentation.

3
  • 4
    is there a way of introducing a dependency or a delay ? I am trying to start several webservices but the second shouldnt start until the first has finished starting-up. The same with the third and fourth services they shouldnt start until the second and third have finished starting-up respectively.
    – robbie70
    Commented Jun 7, 2018 at 16:55
  • 1
    Yes it can be done however not through intellij. You have to write a script that first starts all the services in standby mode waiting for the "go" signal, then have it check somehow to see if the other service has finished, at which point it signals "go" to the next service. In nodejs I was able to do this exact thing by checking the filesystem to see if the manifest.json file was available, and if not, it checks every 2 seconds to see and when it finally finds it, continues the service.
    – TetraDev
    Commented Jun 8, 2018 at 21:46
  • yeah seems like a real nice thing for them to add. is there a new feature request opened on the github repo for this yet? Commented Mar 12, 2022 at 1:02
37

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

8
  • 1
    I'm using IntelliJ IDEA 12.1.4 and this option simply dosent exist Commented Aug 26, 2013 at 17:37
  • @ThiagoBorn I'm using the same version and it does exist. Commented Aug 26, 2013 at 18:00
  • 12.1.4 and it is an option for me. Commented Sep 12, 2013 at 17:28
  • 31
    This doesn't work. IntelliJ waits for each run configurations to terminate before moving on to the next one. A no go for servers. Commented Nov 21, 2013 at 9:55
  • 1
    @AxelFontaine I faced the same problem, but as Lodovik suggests below using Multirun plugin solves the issue.
    – Innokenty
    Commented Mar 17, 2015 at 14:08
19

Check out this Multirun plugin.

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

1
  • Multirun plugin looks good. It allows to run multiple configuration in sequential order with delay. Unfortunately it doesn't allow to run specific configuration in debug mode
    – Geniy
    Commented Sep 2, 2016 at 15:24
7

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.

1
  • They run all in parallel (i use Idea 2022)
    – McLayn
    Commented Feb 5, 2023 at 18:55
1

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.