Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 386
Saeed Avatar asked May 11 '13 06:05

Saeed


People also ask

How add XML to IntelliJ?

In the Project tool window, select the directory, where the build file should be created. Right-click the directory and from the context menu, select New | File ( Alt+Insert ). In the New File dialog, specify the name of the new file with the xml extension, for example, build. xml.

Does IntelliJ support XML?

IntelliJ IDEA brings powerful support for XML that includes structure validation, formatting ( Ctrl+Alt+L ) and indentation ( Ctrl+Alt+I according to the XML code style, importing unbound namespaces, viewing code structure, unwrapping and removing tags ( Ctrl+Shift+Delete ), generating DTD files and schemas from ...


3 Answers

Updated answer for IntelliJ 14+: File-> New-> Project from Existing Sources... (choose your project directory) and follow the wizard Q&A.

like image 95
Willem van Rooyen Avatar answered Oct 07 '22 12:10

Willem van Rooyen


Restarting Intellij should fix the problem. Just make sure you click on the "Import Project" pop-up that appears on the top right.

like image 12
Riwaz Poudyal Avatar answered Oct 07 '22 12:10

Riwaz Poudyal


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.

like image 11
Artem Abramov Avatar answered Oct 07 '22 12:10

Artem Abramov