DEV Community

Cover image for IntelliJ Hacks: Save Run Configurations to Source Control
scottshipp
scottshipp

Posted on

IntelliJ Hacks: Save Run Configurations to Source Control

We've already covered instant Javadoc, prettifying JSON, and multi-line editing, all within IntelliJ. Now let's cover shared run configurations.

If you've been an IntelliJ user for some time, you've probably collected quite a few of your own run configurations. What is a run configuration? It's simply a collection of metadata about a run of any kind. It could the metadata for creating a Docker image, running a web service, running a suite of tests, or something else entirely.

Your run configurations always appear at the top of your screen with a green "play" (triangle) button next to them.

They look like this, when you click the dropdown box:

Screenshot of IntelliJ run configurations

They get created in various ways, but the most common way is simply clicking that little green play button when you see it in the left margin next to some code.

The Hack

Now, for the hack. Most people don't know that you can save these run configurations to files, and check them into source control! That way they can be shared among a team. This is actually a very simple thing to set up:

  1. Navigate to "Edit configurations" in the Run configurations dropdown.
  2. Navigate to the run configuration you would like to save.
  3. Check the "Store as project file" box.
  4. Commit it to your source control the normal way.

More information about this is documented in the help.

Final tip

Don't forget to scrub any secrets out of your run configurations before you check them in. A good way to do this is to replace them with environment variables.

Now go share those things with each other and save your team some time!

Discussion (0)