How to run multiple IntelliJ IDEA configurations after one another (serially, sequentially)? - intellij-idea

Similar to this question, I want to run multiple Run Configurations as one. However, instead of running them simultaneously (parallel), I want to run them after one another in a specific order.
I know I can select another Run Configuration to run before another, like answered here, but approach has one issue: it's not possible to have one generic/main/super Run Configuration that runs nothing else than the specified run configurations. I must to pick one project-specific configuration (e.g. a Python configuration in PyCharm, the JetBrains Python IDE similar to IntelliJ IDEA) to be able to choose Run Configurations to run serially before the main one. This is an issue, because if I ever want to change to or insert a different configuration where the main Python Run Configuration is, I need to remake the Run Configuration Order besides a new one. With a predefined serial list of Run Configurations to execute, this would be as simple as inserting another configuration in the list.
Is this possible and how do I achieve this?

Besides the Before launch functionality mentioned in the question, there is no such possibility in IntelliJ IDEA and other JetBrains IDEs to my knowledge. However, there exists plugins that add Run Configurations that initially do nothing (empty), which can be considered as a generic/main/super Run Configuration. In such a configuration the regular way of specifying other configurations to run sequentially before launch can be used to achieve the question's goal.
An example of a plugin that adds an initially empty Run Configuration is the Multirun plugin. Don't be confused by its name: it's meant to run multiple Run Configurations simultaneously with the option to start them sequentially, but it does not wait for earlier ones to finish before starting the later ones. Just add the default (empty) Multirun configuration and queue up other tasks to run sequentially through the Before launch section.
It's a pity JetBrains haven't added a serial/sequential execution configuration in their Compound Run Configuration, which basically achieves what the Multirun plugin achieves: simultaneous / parallel execution. With compound run configurations, the Run Configuration editor would become a really powerful but simple to program configurations for various wishes like Gradle achieves for more complex build configurations.

Related

WebStorm run/debug allow multiple scripts

Using the "Run/Debug Configurations" tool in WebStorm, I would like to create one script that ends up running multiple npm scripts. For example, I would like to create a single script that will end up executing npm run script-one && npm run script-two.
Is this possible?
You can use Compound type of Run/Debug Configuration.
https://www.jetbrains.com/help/webstorm/creating-compound-run-debug-configuration.html
https://www.jetbrains.com/help/webstorm/run-debug-configuration-compound-run-configuration.html
For example, you may want to run the sequence of several test configurations, or run several configurations of different types (for example, JavaScript, HTML, etc). WebStorm provides you with the dedicated capability for that: a compound Run/Debug configuration. Compound configuration can include multiple configurations of the same or different type with the same or different specified targets.
When you run or debug your code using a compound configuration, you actually launch a sequence of configurations it includes in order they are listed.
Another possible idea: use "Before launch" section to run some other tasks before executing current one: https://www.jetbrains.com/help/webstorm/run-debug-configuration-npm.html#before-launch-options

How to run configurations one after another in Intellij?

I'm trying to create a compound/multirun run configuration in intellij where each configuration runs sequentially. I've tried with both compound and multirun, however it appears that neither allow configurations to be run one after the other (as in the second waits for the first to finish).
Is there any way to do this?
There are related requests for Compound configuration: https://youtrack.jetbrains.com/issue/IDEA-166035 and for Multirun plugin: https://github.com/rkhmelyuk/multirun/issues/63
This is possible by using the plain Before Launch settings of a Run Configuration. There you can specify one or more other Run Configurations. These will run sequentially before running the original Run Configuration.

Run cucumber by right clicking on it in IntelliJ

I am trying to simplify the way we run cucumbers. We have a runner for each folder and we always change the runner in a run configuration that has some VM options set.
I can right click on a feature, select "Run feature :" but it doesn't run successfully without the parameters from the run configuration (one of them runs the tests with an in memory database for example)
Is there anyway I can add a default configuration so I can run them directly?
Run -> Edit Configurations
In the left-hand panel, there is a category called defaults. You can set the defaults to cucumber there. However, note that you might have to delete your previously existing configurations to get this to work with files you've already tried. They usually appear in a faded gray.
In addition, you could also add a runner class, which can run (a subset of) your tests from a testing framework. You can provide #CucumberOptions in this runner.

IntelliJ: Mapping running/debugging specific configurations to toolbar

Googling, searching this site and random experimentation yielded nothing, so here goes.
I'm working on a project containing different Maven projects where several of them need to run in order for the system to work. (Clients, servers, etc.) Launching them all individually is kind of inconvenient, but as this question suggests, there's no way to group them into a single configuration (nor does the situation seem to have changed since that answer).
Instead, I'm now wondering if it's possible to map running/debugging specific configurations to the toolbar, i.e. have a "Run Project 1" button, a "Debug Project 3-C" button, and so on instead of having to do the three-step process of opening the list, choosing a configuration and clicking run/debug for each needed component.
Does anyone know of a way to accomplish this?
You can't have multiple configurations at the toolbar, but I can suggest a better alternative for running multiple configurations at once.
In IDEA 12 it's possible to run another configuration in the Before launch section. So you just add all the other configurations you want to be started with the current one in Before launch steps, then run single configuration and get all of them launched. Note that you can run Maven goals from the same configuration:
As you've noted, it will not work if the configuration continues to run as it will wait for the command to finish.
I'm afraid there is no easier way to do it right now except probably using the keyboard shortcut for the run popup menu.
Here are the issues you should vote for:
IDEA-94341 Launch Multiple "Run/Debug Configurations" At Once
IDEA-69968 Add option to assign keyboard shortcut to Run/Debug configurations
IDEA-75078 Make it possible to create toolbar action for running specific run configurations

Intellij IDEA: multiple goals, multiple projects, one button

I find myself often running the same goals (clean install) of different, interdependent maven projects in Intellij IDEA one after another.
Does anyone know of a way to configure something like a maven goal combination, ideally such that you configure a button in IDEA's task bar that you can hit to execute these goals in sequence? Possibly even with a keyboard short cut?
Similar things might be achieved with a maven run configuration, but then IDEA wouldn't automatically be aware of the changes the run does to the project's file system resources.
Cheers,
Johannes
Easy solution for me was to create a Run Configuration (type=Maven) per module, putting multiple goals (e.g: clean install) as cmd line for each of them, then linking them up into a chain, by adding an appropriate one under the "Before launch" section.
You can link up the last of the chain as a "Before launch" for the actual app Run.
Then you can, if required, just restart a running instance if your app which will rebuild your maven projects in order, and start the app again.
I frequently run a clean install of my maven aggregator project from the command line while it is open in IntelliJ. In my experience the IDE seems to handle this quite well.
when you open the MVN - 'Run Anything' appears - beside that there is a PROJECT drop down, from which you can select for which project you want to run the maven command.