Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I share IntelliJ Run/Debug configurations between projects?

People also ask

Where are IntelliJ run configurations stored?

By default, it is disabled, and IntelliJ IDEA stores run configuration settings in . idea/workspace. xml.

How do I import IntelliJ run configurations?

How to import the xml in a new project? Open Left Project Pane -> Copy . run folder -> open another project without closing intellij -> Paste on main project level. Your previously saved run config appears here.

What is run debug configuration in IntelliJ?

The list shows the default run/debug configurations. Select the desired configuration type (for example, Go build). The fields that appear in the right-hand pane display the default settings for the selected configuration type. Run kind: a building scope for your application.


The best way to do this is to click the "share" checkmark next to Name field when you edit/create the configuration. You can get to this Dialog with Run > Edit Configurations.

enter image description here

The share check-mark pulls the setting out of your workspace.xml and instead puts it in the directory .idea\runConfigurations. This is designed so you can share the setting with others. You could copy this file and put it in the same location in all your idea projects.

However, in the future, you might want to consider using source control branches for app versions rather than separate projects. IntelliJ handles these very well.


UPDATE (June 2021): IntelliJ now puts this in the .run folder as its own file, no longer in .idea/runConfigurations.


Run configurations are stored in .idea/workspace.xml by default. First alternative is to share this file but it is not feasible because you also share a lot of unnecessary configurations. As already said, the first step is to check "share" option to separate run configurations from workspace.xml.

dispatching run configurations from workspace.xml

After that, I recommend adding runConfigurations to source control. But the main problem is, probably you have already marked .idea folder as ignored. You can unignore the folder by configuring your source control system. For example, if you are using git, you can change .gitignore file as follows:

.idea/*
!/.idea/runConfigurations

don't forget adding * after .idea/

As the last step, add your run configurations to source control and enjoy your shared configurations!


goto

Run > Edit Configuration > create or select existing configuration you want to use > click save and persist it on file system > click on share check mark

now copy this file from

 PROJECT_ROOT_DIRECTORY/.idea/runConfigurations/ConfigurationName.xml

to your NEW_PROJECT_ROOT_DIRECTORY/.idea/runConfigurations at the same place and it is available now to your run configuration


You should copy the folder

~/your-old-project/.idea/runConfigurations 

to

~/your-new-project/.idea/

That's the folder that contains the run configurations.


An update for this question with the new IntelliJ updates:

Now you can "Store as project file" which will create a folder named ".run" and export your setting to that folder. In the example below, I did it for all my test settings. This removes the requirement of editing .gitignore since files are now not outside of ./idea

store as project