My intellij java project can't find misc.xml
Solution 1
At first, you shouldn't really ignore everything under .idea but instead only .idea/workspace.xml and .idea/tasks.xml, as it JetBrains states: http://devnet.jetbrains.com/docs/DOC-1186
To solve your problem and get your project back to working state there are possibly two solutions:
-
Checkout the last commit that contains the files under .idea folder with
hg checkout SHA
, where SHA is the commit id.After that reset your working space to the head:
hg reset HEAD
Edit your .hgignore in the way that was recommended before, add project files to stage, and commit them:
hg commit -am "Reverted project settings"
If there is no commit with the project settings, you can just import your code back. Start Intellij IDEA and choose "Import Project". Choose the folder with your code, and choose the appropriate SDK after.
Solution 2
Updated answer for IntelliJ 14+: File-> New-> Project from Existing Sources... (choose your project directory) and follow the wizard Q&A.
Solution 3
Restarting Intellij should fix the problem. Just make sure you click on the "Import Project" pop-up that appears on the top right.
Solution 4
I met this problem when I did rm -rf project
command, then when I git clone a new project to my working space, maybe quit the idea and then import the project again. This can easily solve this
Solution 5
I have found that for this error and also for some other cases where the IDE project behavior is inconsistent with command line behavior, the following often helps: close the project's Intellij IDEA window, delete .idea/, and open the project again. IntelliJ often flashes up a message saying it didn't find a project root but generally this disappears after a few seconds and IntelliJ automatically rebuilds the .idea directory.
Related videos on Youtube
Saeed
I am an IT engineer and work in electronic found transfer area.
Updated on August 27, 2020Comments
-
Saeed almost 4 years
I have a java project in Intellij and use Hg/Mercurial for version control. I ignored some files with this
.hgignore
filesyntax: glob target/* .idea/* *.iml
and deleted all these files which was committed before. but now I can't execute my project, cause it can not find the file
misc.xml
.What should I do?
-
CrazyCoder about 11 yearsTry restoring the deleted file using the Local History feature.
-
-
Andrei Dziahel about 10 years
hg reset
, seriously? -
Rubbal over 7 yearsIn latest version, this has no effect if the project is already open (I think intellij sees that the new project is already there and hence does nothing). Instead you can close the current project and click on Import a project which will let you overwrite the existing project.
-
Все Едно about 7 yearsRubbal, dude what you said should have beeen the best answer. The 2 answers above requited an extreme ammount of researching to just make em work. I did as you said and itnellij auto created missing files and it just worked