IntelliJ: Mapping running/debugging specific configurations to toolbar - intellij-idea

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

Related

Is there a way to fix the used Run/Debug configuration in IntelliJ?

I often switch between running/debugging tests locally in IntelliJ and using remote debugging my server. Therefore I have multiple run/debug configurations (the gradle ones were created automatically):
Whenever I execute a local test like PdfA...en.ttete this profile is selected by default in that combobox. But I want it to stay default on entry Remote...Debugging 5050 so that I can easily run this profile. Is there a fix?
Other solution would be to define a Hotkey for my favourite configuration. But I couldn't find it.

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.

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

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.

Can I commit and share VM options in IntelliJ?

To execute my application, or run or debug unit tests, I need to enable various VM options, include -javaagent:<aspectjweaver-path> or -Djava.library.path=<some native lib path>
I can see how to change these configurations manually in IntelliJ IDEA under "Edit Configurations..."
What, if anything, do I need to check in to my VCS to share these settings with other members of my team, and ensure they pick them up automatically whenever someone changes them in the VCS?
Alternatively is there a way to set these automatically in IntelliJ without even touching the edit configurations? Especially the aspectjweaver. When I build/test my project from the command line using maven this is all handled for me by specifying argLine arguments to the surefire plugin, but IntelliJ doesn't respect these settings. Perhaps there are alternative plugins that can help me out?
First, you need to share your run configuration. It's simply done by checking the Share box right to the configuration name in the run configuration dialog:
Your run configuration will then be saved to .idea/runConfiguration (or whatever your settings folder name is).
From Jetbrains Web Help:
If this check box is selected, the run/debug configurations become available to the other team members.
The shared run/debug configurations are kept in separate xml files under .idea\runConfigurations folder, while the local run/debug configurations are kept in the .idea\workspace.xml.
This field does not appear for the default run/debug 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.