'How to prevent Intellij from creating a temporary run configuration and automatically switching to it

Intellij will create a greyed-out run configuration every time I execute an unsaved run operation from some menu, be that run a unit test, run a maven build, or some other execution from a menu item (there are a lot of ways to get a temporary run configuration).

These unsaved configurations are automatically switched to. Running anything changes the run configuration dropdown box at the top of the IDE, but I never asked for this behavior.

  1. Is there a way to disable the automatic switching? I want to maintain my selection of the run configuration always and forever, amen. Stop Intellij from switching it for me.
  2. Is there a way to disable the automatic creation of temporary run configurations, altogether? I never want to be bothered with temporary items in the run configuration inventory that I later feel like I need to clean up. Removes the clutter by never creating them in the first place.


Solution 1:[1]

2021.1 version no longer has this setting, issue reported.

As a workaround you can close the project and edit .idea/workspace.xml file manually.

Under <component name="PropertiesComponent"> node add/edit the following:

<property name="recentsLimit" value="0" />

For 2020.3.x and earlier versions:

Run/Debug Configurations | Templates | Temporary configurations limit: 0.

Temporary configurations limit

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1