IntelliJ: Doesn't Save my edit configuration settings - intellij-idea

When i do Edit->Run Debug Configurations, the settings that i have put in for working directory, vm options etc do not stick. I would run a program and come back to see that the options are no longer set for the next run.
Is there a way to sticky these settings?

You can save your run configuration to ensure that it (and anything configured within in) is available for future use.
Click on the file/save icon in the Run/Debug Configurations window.
Here's a screenshot:
More details in the docs. Specifically:
Saving a temporary run/debug configuration
To save a temporary configuration, do one of the following
In the Run/Debug Configuration selector, choose Save .
In the Run/Debug Configuration dialog box
On the context menu of the editor or Project view, choose Save .

I faced the same issue that I was unable to save Run/Debug configs and funny enough the Save button is never visible even if I create a new config. So I just started creating folders for my configs which definitely save them for future use.

Related

IntelliJ grayed out Run Configuration

Using IntelliJ I have some Run Configurations that are grayed out.
I can still run them but I can't find why they are grayed out.
A dimmed run configuration simply means it hasn't been saved. Technically called "temporary run configurations" by the IntelliJ manual:
Temporary configurations are marked with semi-transparent icons and are managed same way as the permanent configurations. By default, 5 temporary configurations are allowed per project. You can change this limit via the Edit ConfigurationsĀ dialog.
Saving (which makes the config permanent) can be done in either the "Run/Debug Configurations" menu (visible only when selected), or in the config selection dropdown in the general UI:
After saving, the configuration will move up to group with the reset of the saved configurations and will no longer be dimmed. As far as I can tell, you can have as many saved configs that you want.
To fix this:
Go to your project directory
Select a folder -> New -> Java Class -> Filename.java
Go to add configuration
Fill these fields like in the image:

IntelliJ & Global Config Files

I've been searching for a solution but I can't find one.
I have a global configuration directory in my IntelliJ workspace. I also have several dozen modules. I would like each module to automatically include the global config directory in its path when I run or test a class.
Is there anyway to do this within IntelliJ? I don't think I should need to edit the configuration for each "Run/Debug" config to include the directory.
You'll want to set it in the Defaults for the type of Run or Debug Configuration that you are using.
For example, if I always want a Java Application to have the VM Option -XPutYourThingyHere, then I could go to Edit Configurations, Defaults, Application, and put -XPutYourThingyHere in the VM Options box. Then all new Applications that I run will have that option.

PhpStorm Deployment menu greyed out

I've added a server in PhpStorm deployment settings but the Tools -> Deployment -> Upload to menu is still greyed out.
You need to specify a deployment path mapping in your server. Even if it's just the root path, you need to enter /. PhpStorm doesn't do it automatically.
Go to your server in deployment settings, click the 'Mappings' tab and enter slash (or your mapping) in the 'Deployment path on server' field. You don't need to enter a web path. Deployment menu should be ungreyed now.
In version 2019.2, if you dont set the path to / in mapping, it will grayed out.
Previous version, you could leave it blank
Also, if your local path (inside mappings configuration) is not your project root, you have to click on the deployable folder in the project tree to enable the menu.
Also, if the Deployment menu is completely missing at the bottom of the context menu, then set up a default server.
Click the server with the check mark to make a server the default option for a project.
Then you will get this additional menu when you right click on a file, folder, or the project.
I also encountered this issue in PyCharm Professional 2022.1.
Since the aforementioned solutions did not work for me, and it took me some time to resolve, I am providing the solution I found.
Clicking on Tools -> Deployment -> upload to servername was not working for me no matter what I tried.
However, I could right-click on the main project folder (on the left of the PyCharm window, where the project folder/file structure is visible). This right-click opens a menu, where there is an option for deployment -> upload to servername.
Once I clicked this, not only it worked, but the classical way (Tools -> Deployment -> upload to ) ceased to be grayed out also.
If deployment was available and suddenly no longer works, confirm that your credentials didn't get wiped from the deployment settings (Connection tab).
If any of these answers don't help, because you can't even see the server menu, you probably have the Remote Hosts Access plugin disabled.
Go to settings, go to the plugins, and enable Remote Hosts Access.
Please check if the following options are enabled in settings(Ctrl+Alt+S). It goes uncheck if Php Storm crashes. Check the below options and restart the editor.
This works for ver 2017.2.1
Also, check Windows->Store current layout as the default just to make sure in the future you can restore the layout.
It's possible the opened file in the editor belongs to a External Library (bottom of project tree).
These External library files can't be deployed.

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

I have many different versions of my app. Each one is a separate IntelliJ project. Every time I open a new one, the list of configurations starts blank:
The annoying thing about this is I deploy to 1 VM and I have to copy and paste the debug configurations each time I want to test a different version. IntelliJ makes this dialog modal per IntelliJ Instance, so I can't copy and paste the fields between Project Instances.
I end up taking a screenshot of one configuration and copying the fields by hand into the other project. It's a pretty primitive solution. Is there a more convenient way to get a run configuration from one project to another?
I'm using IntelliJ 13 on Windows 7.
Can I share settings for IntelliJ Idea across different projects? may have the answer to this, but the question is different. It's about window layout. Therefore I don't consider it a duplicate.
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.
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.
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
This is not exactly an answer to your question but it answers a question similar to your question and one that I had, and I'm assuming others might as well.
That is, How to save unit and instrumentation test run configurations? I usually right-click on the test directory which brings up a menu with the option to Run whatever is in that directory. AndroidStudio then creates a run configuration on the fly and in the Run Configuration drop-down menu a new option will appear, "Save new configuration?" or something similar.
Clicking that option brings up the Run Configuration menu and at that point I check the Share box as many others have already mentioned. This then will prompt the version control system to ask me if I want to add this new run configuration file. If you haven't registered your version control system you can find the new files under .idea/runConfigurations.

All IntelliJ run configurations disappeared

After IntelliJ IDEA froze and was killed from the task manager, all the Run/Debug Configurations disappeared. I have tried invalidating caches, reloading files from disk, synchronizing and restarting, but nothing helped.
You can try to restore your Run configuration using the Local History feature of IntelliJ IDEA.
If you are using .idea directory based format, then your configurations will reside in workspace.xml file under .idea directory, invoke Local History dialog from the .idea directory right click menu in IDEA Project View, select the label some time before the crash and revert the old copy of workspace.xml.
In case .ipr file based format is used, your configurations will be stored in the <project>.iws file in the project root which you can restore in a similar way.
If the configurations were Shared, they are stored in .idea\runConfigurations directory as separate XML files or in the <project>.ipr file (if old project format is used).
If the Local history is blank and you are in Windows, try Restore previous versions right clicking the workspace.xml file or the <project>.iws one in Windows Explorer.
You can go to your main project and right click on it, select local history --> show history. Find some point in time where you think that system was stable (before crash) and click revert. This worked for me.
To me, this frequently happened on switching branches. Turning off "restore workspace on branch switching" helps to prevent the run configurations from getting lost.
Edit: Not sure if it actually has an impact, it still seems to happen to me sometimes, maybe less frequently though. I'll leave it here since the answer already has some upvotes, so maybe this was the solution for someone...
For every project in intellij there's a file created with all the configurations related to it.
Under the root directory of the project there's a hidden folder .idea in it is the workspace.xml with the configuration. workspace.xml is comprised of components one of which is responsible to hold the run/debug configurations.
If this file is getting corrupted it's difficult to restore these configurations if you don't have a backup of workspace.xml. to overcome it:
1. in intellij right click the workspace.xml file under project view and choose Local History -> Show History
2. if there's no history you can copy the component from a coworker with similar configurations.
3. backup in advance the workspace.xml and retrieve the RunManager component from it..
another good choice is to use the share option.
under each project's definition there's a checkbox share
Marking this checkbox will extract the definition for this project to an external location:
under the same .idea folder a new folder is being created runConfigurations and the configurations per project are being represented there in xml files.
The advantage of using share is that it can be copied and used for similar projects under other branched like QA and production
In my case, i've accidentally pressed Alt + Home and this bar disappeared, this combination toggles run bar at the top of IDEA window for me.
Here the screen with my bound actions on this keys. I hope it should help
Run configurations are stored in your project files. When IntelliJ (or your computer with IntelliJ running) crashes hard, the project files can become corrupted and unreadable. I don't know of a way to recover this unless you have your project files are backed up somewhere.
Navigate to your project folder and check weather any .idea folder is created or not,
if created copy your project and paste it other location ant try opening it;
it will work.
I sometimes have the problem that all the run/debug configurations are not created from CMake after being lost. I solved this by just deleting the whone list of configurations from the workspace.xml (from .idea folder).
This happened to me recently and I just restarted IntelliJ and they shared ones (in .run) are now restored.
In my case what happened was I did something that made IntelliJ recognize the project as a new application type, so it thought my old configuration was not valid for my project anymore and wasn't displaying it to me. I reverted my changes and the configuration appeared as an option again.
I guess this feature can't be removed from IntelliJ but I guess this can help:
Run/Debug configuration functionality might be hidden, so to show it go to:
View/Appearance/Navigation Bar
Very annoying problem in Intellij Idea for many years.
It's quite often breaks because of broken (connection to?) Ant debugger, used to create run configs.
I was periodically searching for a solution, but no success. Then today after disappeared Run Config to display in panel I did inspect contents of workspace.xml. All the run configs were there.
And then it turns out to be 7+ years bug clue...
Always spring out non-called Ant...
Happily, contents of workspace.xml in place with all your run config items, you can just
disable infamous plugin Ant debugger,
reload the project,
and all your run configs are displayed and available again))).
Happy to share with all of you the solution).