Search code examples
mercurialintellij-idea

My intellij java project can't find misc.xml


I have a java project in Intellij and use Hg/Mercurial for version control. I ignored some files with this .hgignore file

syntax: 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?


Solution

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