Intellij Load Settings error - intellij-idea

After a computer crash i get the following error in Intellij:
Cannot load settings from file 'C:\Users\*\.IdeaIC14\config\options\mavenVersion.xml': content truncated
File content will be recreated
What I've tried to no success: clearing \caches folder, deleting mavenVersion.xml file.
Please help restoring peace in Intellij IDEA!

In my case, there were Intellij and Android Studio installed on my machine.
I deleted the .idea dir in the project. Opened the project in Android Studio. Closed it. Then everything was fine in IntelliJ.

I am pasting the contents of my mavenVerison.xml file for you - please recreate the file with this contents, in the specified location, and give it another try.
<application>
<component name="MavenVersion" version="3.x" vmOptions="-Xmx512m" embedderJdk="#JAVA_INTERNAL" />
</application>
Note that I am using maven 3.x.
If this doesn't work, and if you don't mind reconfiguring your environment again, stop IntelliJ, move the entire .IdeaIC14 folder to some place else, and restart IntelliJ.

Related

How to fix a broken Intellij Idea?

When I open an existing Maven project, the IDE shows only those files on the root directory, but not any directories in the project. After a while, the IDE will show the project as what it is in the file structure, but not the directory types such as source code, test when I reopen the project. I reinstall the community edition, but the problem still resists. I have experienced the same issue for a few Java projects lately.
How to resolve this issue?
1, Please ask another teammate to check if that project really works. Sometimes the application structure already broken, then it is not your local problem.
2, There is a .idea folder in the application, delete it. Or simply, you git clone a new place Important: Please notice if you have edited / created some new files in the original directory, otherwise you would lost them if you delete the application.
3, Open intellij, and File -> Invalite caches
Personally, the second point is recommendated.
Try to click on Reload All Maven Projects in Maven tool window:
If it doesn't help you can try to perform the following actions:
Close the project with File | Close Project.
Close the IDE.
Open your project in OS file manager and remove all .iml files and the .idea directory.
Reimport the project.
If the problem remains contact JetBrains support and attach a compressed log folder along with the project structure tree.

Intellij IDEA 14: Error Loading Project: Cannot load module cars-service

With my last restart of my mac I had a problem with IntelliJ IDEA project : the .iml file was deleted and I have
Error loading project: cannot load module cars-service Details ....
in the console.
Besides that, the structure view of the project has disapeared.
Here is a screenshot:
Finally, I imported my project via import project so the iml file was recreated.
Closing intelliJ. Deleting the .idea folder and re-opening intellij worked for me.
This happened to me this morning*, and fortunately there's a fairly straightforward solution.
Press Ctrl+Alt+Shift+S (or go to File > Project Structure...) and click Modules on the left of the window.
Click the green + above the list of modules then New Module. Select the type of module (Java, Android, Flash, what have you) and click Next.
Enter the details of the lost module. Click the browse button to the right of Content Root and navigate to the directory that contains your lost module. The module name will be populated with the directory name by default, but you can rename it without issue.
(*I... got a bit gung-ho with the old git clean -fd. I don't recommend it.)
The error has nothing to do with gems. Please try deleting the .idea directory and using "Open Directory" on the same directory again to recreate it.-- Dmitry Jemerov
↑an answer on intellij-support.jetbrains.com
This helped me. I just closed Pycharm, then delete .idea directory , then I open Pycharm again, and the error disappeared.
Please try File -> Invalidate Caches / Restart ...
Had a similar issue with PHPStorm (which is also idea based), caused by a renaming of my project. Solution was simple: I just needed to remove the corresponding line for the module declaration in file <project-directory>/.idea/modules.xml. Re-opening the project was not needed as it seemed to me, but I did it anyway.
Have had this issue with PHPStorm 2017.1.3.
IML file is necessary to load the project.
Locate the folder the .iml file used to be in > right click > Local history > show history.From there you should be able to restore that iml file
you can fix it by select your pom file. right click and then reimport

In IntelliJ, How Do I Fix "These Files Do Not Belong to the Project"?

I recently put several old, yucky git directory structures into one new, clean structure in SVN, then pulled the entire SVN repository back out into a new, clean, local git repository. One IntelliJ project was so messed up I had to import the old IntelliJ project, which created a new .iml file having a better name, and deleted the old .iml file. I reconfigured everything, committed back into SVN, and verified other people could open the project and build.
Today I tried to edit a file for the first time in this project and got the message, "These files do not belong to the project". IntelliJ offers to unlock the file or all non-project files in the current session, but both options sound wrong. What have I done to myself, and how do I fix it?
This happened for me when I ignored the .idea/ files. Just do
rm -rf .idea/
And then File -> Invalidate Caches/Restart -> Invalidate And Restart.
I figured out the problem. The file was still open from before all the shuffling, and was apparently pointing at the original file in its original location! I closed the editor and reopened the file from the project tree without a problem. I hope this helps someone else someday.
From File-> Repair IDE -> Rescan Project Indexes -> Reopen Project worked for me.
Had same problem on Ubuntu (Webstorm), got answer from Intellij.
There are no content roots in your project, so all your files are
treated as non-project files. As I wrote your .idea files are likely
broken, the .iml file and/or modules.xml are either missing or
corrupted. Deleting and re-creating .idea folder should help:
-close the project
-remove it from Recent projects list
-shut down the IDE
-delete the .idea folder
-restart, open the project root folder with File > Open
https://intellij-support.jetbrains.com/hc/en-us/requests/3779670?page=1
This also happened for me when I opened the project through a symlink (parent directory) or when the python interpreter was inside a symlink directory (because of virtualenv).
Reopening through the original directory tree (after fighting hard with the IDE to forget its beloved project settings), solved the issue.
It's probably listed in one of the XML config files in .idea/*.xml.
Just do a find of that folder for the name of the file in question, and remove the entry for it from the XML.
Mine was listed in .idea/workspace.xml within the following node: <component name="TypeScriptGeneratedFilesManager">.
I removed the option, then invalidated caches and restarted, and now the file is marked as a standard, non-generated file again. This way you can keep all your settings without exporting them and importing them.
Similar issue with WebStorm. The difference was I had to shutdown the IDE completely and then remove .idea folder
rm -rf .idea
I tried doing it with the IDE open and going to file File -> Invalidate Caches but that did not fix the problem for me.
Same problem. File was considered not part of the project even if I deleted it and created a new one with the same name.
To fix,I highlighted the project node in the left panel, selected "File/Invalidate caches and restart" from the top menu.
After the restart I had to set my file as a JS file (right click, set as JavaScript), close and reopen the project. All fixed.
For me the above did not help. I ended up going Project Structure -> Modules -> + at the top narrow middle column -> browsed through files to select the Project Folder -> apply -> ok -> all is done and working correctly.
My problem was much simpler than expected: I was trying to run a Jupyter notebook and got the error - because it was inside a folder that was marked "excluded" in the project structure.
Simply moving the notebook out of the excluded folder solved my problem.
In my case it was auto-generated .gitignore, I had entries like:
### npm ###
node
node_modules
frontend-dest
data/
And in project files I had java package called like com.company.test.data which matched last pattern. I strongly recommend to check it before removing .idea/ files and invalidating cache.
This warning is an IDE issue that Android Studio cannot recognise the current directory if it does not include any source files.
So, adding am empty source file, e.g empty_xxx.c under the directory in question and adding below line in CMakeList.txt
add_library(${TARGET_NAME_XXX} SHARED ${SOME_DIR_HAVING_THIS_WARNING}/empty_xxx.c)
will help get rid of this warning.
In my case the above methods didn't help, I just deleted .idea file in project and reset the Jetbrain IDE to default settings and it worked normally.
NB: You will loose all your settings and plugins, but if you don't mind this might help as the last resort like in my case.
I am using Jetbrain,
make sure to include all project files in the project. Use Settings -> project structure.
PyCharm > Preferences > Project > Project Structure > Add Content Root
Somehow PyCharm lost the project root directory in my case
For me it was because I had moved a project to wsl by copying the files from wsl to windows. When I switched branches the file must've been open from before and was the windows version of it and not the wsl one.
I noticed this finally by looking on top of the file tab and seeing the path as C:\User...\filename instead of \\wsl$....\filename.
Close your JetBrains IDE, then open a Terminal window and navigate to your project's root folder, and run these 2 commands:
rm -rf .idea
and then
rm -rf .git
NOTE: you'll probably have to connect your project back to your git repository, so if you have any uncommitted changes make sure to commit and push them beforehand to avoid losing them.

Folders missing in project pane in Webstorm

I've built a project in WebStorm and then submitted the project to GitHub.
When I rebooted the computer and relaunched WebStorm (and the project), all I can see in the project pane is the root files, and none of the folders (yes the folders are there)
See the image below for reference.
Does anyone know how I can get those folders to re-appear in the project pane of Webstorm?
It can be caused by the corrupted .idea/modules.xml project file. You can either try to fix it manually (restore from Local History, version control or backup) or create the new project from scratch.
Check this issue for the hints/workarounds.
It happens sometimes in WebStorm 9.
The easiest way to fix it for me:
close WebStorm;
in project's folder remove .idea/ (hidden directory);
open your project, enjoy:)
Solution:
Creating a new project from existing sources
File => New => Project
Select "Empty Project"
Browse to the location of your project with folder issues
Click "Create"
Select "Create from Existing Sources" in the "Directory Is Not Empty" dialog
Why this solution:
Editing and deleting in various combinations of .idea and XML files did not solve the issue for me. Hence the solution above. Back up your .idea directory in case you have project customizations you want to keep. This likely overwrites them.
Outcome:
All the various folders I had created were now visible and the project worked as expected. The .idea directory was now formatted correctly with all the necessary files.
Find the .idea/modules.xml in your project root
make sure that these lines are correct :
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/NameOfYourProject.iml" filepath="$PROJECT_DIR$/.idea/NameOfYourProject.iml" />
</modules>
Replace NameOfYourProject.iml with the name of your project.
Then, make sure that the file .idea/NameOfYourProject.iml exists, if not , create it and put this in it :
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="PHP">
<CLASSES>
<root url="file://$MODULE_DIR$/../../php/PEAR" />
</CLASSES>
<SOURCES />
</library>
</orderEntry>
</component>
</module>
You do not need to delete whole .idea folder and reconfigure your whole project, just
delete the .idea/modules.xml
restart the IDE and your folders are there again!
I ran into the same issue and resolved it by invalidating the cache.
The option is under File > Invalidate Caches/Restart.
On the prompt click Invalidate and restart.
Note: The project in concern needs to be open before you do this.
I see this from time to time. I use Git, and I have my .gitignore file set up as recommended, specifically:
.idea/workspace.xml
.idea/tasks.xml
.idea/*.iml
I sometimes see this after cloning the repository, and when trying to figure out why, I came across this post and read the accepted answer.
I deleted the modules.xml file and reopened WebStorm (2016.2.4), and it was resolved. I looked at the new modules.xml and found that its contents were exactly the same as before, but my <projectName>.iml file was bigger.
So it seems to be a corruption in the .iml file, not modules.xml. I assume that deleting modules.xml triggers a rebuild of the .iml file. Not sure if this helps anyone with anything, but thought I would offer the extra insight.
floor 36 solve my problem. in WebStrorm 11
It happens sometimes in WebStorm 9. The easiest way to fix it for me:
close WebStorm;
in project's folder remove .idea/ (hidden directory);
open your project, enjoy:)
Try deleting workspace.xml and watchertask.xml then just restart the IDE. You must see your full source code in all folders there.
Finally I found the culprit, it was Team Foundation Server - Version Control Integration plugin from https://plugins.jetbrains.com/plugin/7961-team-foundation-server--version-control-integration/
I looked at the system/log/idea.log file and found that this plugin was producing Null exception whenever I open a new folder as a new project and breaks the content root auto detection by the IDE, and after I uninstalled this plugin, all folders show up as it should.
You might have this issue because of a culprit plugin, and disabling those which you have just installed recently just before this issue occurs, will resolve the issue. Check the log file and search for ERROR.
If it is found to be an important plugin you are actively using which you are not willing to disable, then a temporary fix is to open Settings->Directories and click Add content root button to add the root folder of your project, click Ok now folders will show up and indexing will begin, and of course you have to do this everytime you open a new folder as new project.

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).