74

Every once in a while, I open an old project and I can't see any of the folders in the intelliJ project viewer. I can see all the files at the root.. but no folders. Yes I can delete the .iml file and .idea folder and re-create the project, but come on.. there's gotta be an easier way to fix this.

Is there?

vikingsteve
  • 38,481
  • 23
  • 112
  • 156
B T
  • 57,525
  • 34
  • 189
  • 207
  • 1
    If you look in project settings (ctrl-shift-alt-s), can you see a module structure? And what verison of intellij are you using, 12 or 14? – vikingsteve Feb 06 '15 at 10:39
  • I'm using version 12, under Modules there is "Nothing to show" – B T Feb 06 '15 at 21:38
  • Heyyy, and checking my other projects, there *is* stuff to show in those. I added my root folder as a web module, it complained about the name already existing and I judiciously ignored that warning and pressed OK. Now my folders are back! Thanks! – B T Feb 06 '15 at 21:39

13 Answers13

113

If you look in project settings (ctrl-shift-alt-s), you should see a module structure. If you instead see "Nothing to see", do the following:

  1. In Project Structure -> Modules, press the + button,
  2. press enter (since, for some weird reason, it won't let me click on "New Module")
  3. In the window that pops up, click on the "..." next to Content root, find your root folder, and select it
  4. Press ok
  5. ignore any warning that says the name is already in use (or to that effect)
vikingsteve
  • 38,481
  • 23
  • 112
  • 156
  • 1
    Thanks! Although, I still don't know the real cause. The last thing I did was renaming a bunch of things... and **boom**. – Rubens Mariuzzo May 23 '16 at 22:38
  • 1
    Very useful for a new empty project that has a folder with source created inside it but is not showing up as a module in intellij. – Jeremy Jul 04 '16 at 16:05
  • Thanks! Worked for me, too. RubyMine 2018.1.3 project on OSX, folders disappeared from Project sidebar menu after switching git branches. Preferences > Project Structure > + Content Root. – Justin Jun 18 '18 at 21:37
  • I did the above which restores the content root and subfolders, then I do File->Save all. When I restart Intellij the folders are gone again. Running Intellij 2020.2 on Ubuntu. – Tomasso Oct 01 '20 at 00:03
79

the simplest solution worked from me, just delete the .idea folder

keep in mind this will delete all of idea's current project configuration, it'll create the folder with default settings when reload the project again... but all other configuration will be lost if not properly backed-up

shahaf
  • 4,750
  • 2
  • 29
  • 32
  • 2
    did you loose all your project configuration? – JesseBoyd Feb 04 '18 at 22:41
  • 2
    most simple and best solution – Mulgard Mar 12 '18 at 12:34
  • Thank god. You nailed it! – ChikuMiku Jul 24 '18 at 18:44
  • 12
    Be aware that if you configured anything in the project you will lose it. And please - always move the `.idea` folder someplace else (instead of deleting it) so if you regret it you can just close intellij and move it back. – vikingsteve Oct 17 '18 at 14:13
  • 1
    This way, you also lose the run and debug configurations, the compiler settings, the file encodings, all shelved snippets, and any adjustments you may have made to the project (e.g. dictionary). – foo Aug 18 '21 at 13:52
  • rm -rf .idea/ simple but awful solution. btw, for projects without too much configuration it works like a charm. – Jorge Tovar Sep 15 '22 at 15:29
47

It might be because the project didn't have any modules defined. Try adding existing source code by hitting File > New > Module from Existing Sources and select the parent directory of the project for source code

Module from existing sources

Harish Gokavarapu
  • 1,785
  • 17
  • 13
  • 4
    I preferred this answer, as using the Project Structure dialog forces me to choose an SDK or framework, which was not appropriate for my project. Thanks! – wgj Aug 23 '19 at 15:56
9

Go to pom.xml file -> right click -> maven -> generate source and update folders. You will see your files and folder structures in left hand side.

Begineer
  • 191
  • 3
  • 3
  • It's been driving me nuts. Ok, I right clicked on pom.xml and selected "As Maven" and that seemed to do the trick for me. (Since my project is a Maven project...) Might work for others who are using other build frameworks too. – iJames Jun 06 '19 at 22:09
  • Most helpful and correct solution!... helped even after 3 years :) – ronit May 26 '21 at 05:39
  • `Right Click on pom.xml > Maven > Reload Project` did the job for me. – Muhammed Bera Koç May 29 '21 at 10:10
4

All the project-specific settings for a project opened through Intellij IDE are stored in the .idea folder.

The .idea folder (hidden on OS X) in the solution root contains IntelliJ’s project-specific settings files. These include per-project details such as VCS mapping and run and debug configurations, as well as per-user details, such as currently open files, navigation history and currently selected configuration.

So, if you are not able to see the project file structure in your Intellij IDE, just delete the .idea folder,

rm -rf .idea

and reload the project, then after reload you'll be easily able to get your project structure displayed.

2

Thank you very much. I just remove the .idea folder and works in my case.

rm -rf .idea
greeneley
  • 87
  • 7
1

For gradle users: "Reload All Gradle Projects" option should help. enter image description here

user1123432
  • 368
  • 3
  • 8
0

For me, the java folder was not showing up. I went into File->Project Structure. In the second column, I selected on _main. In the third column, I selected the tab "sources". In what I call the fourth column, where the "+Add Content Root" is shown, I verified, the java source/folder was present. In my case, there was an extra source folder, which was the current location. I removed this, applied and the java folder immediately showed up.

Scott
  • 1
0

Right click on the Project name -> Open Module Setting -> Check the application context path set it up at your project location.

PJoshi
  • 1
0

Check your idea.log -- it may have some details explaining why or what is happening (Help | Reveal log in Explorer). Possibly one of the config files got corrupted.

You can always backup and delete .idea subfolder (project settings) and re-create project from scratch. When it's wroking again (after basic configuration) you may copy some of the files from that folder back to recover some of your settings (if there were many).

Tikloy
  • 1
  • 2
0

This happened to me on a new computer when I opened up a Java project in the newly installed Intellij.

The problem was that I had not installed any JDK on the machine.

I had to install a JDK and then go into the settings at ctrl-shift-alt-s and add a JDK by specifying the folder where I installed it. It's possible that IntelliJ would have found it if I closed it and reopened it.

Lee Meador
  • 12,829
  • 2
  • 36
  • 42
0

In my case the solution was to create a new project, specifying the project type and creating it within the same directory path as the project that does not load the project files correctly.

PhpStorm automatically detects that the directory exists and gives you the option to create project from existing sources.

This can be found under: File --> New project...

0

One solution that works for me:

  1. Click on the file button in the upper left corner.
  2. Click on the Project Structure button.
  3. Go to the Modules category.
    1. If you do not have any modules with the name of your project, click the "plus" sign (+) button at the top.
    2. Click on the New module button
    3. Choose your language
    4. Click on the Create button
  4. Click on the name of your project, on the categories on the right, select "Sources" (leftmost option).
  5. Set the content root.

It avoids deleting you .idea.

Pioupia
  • 339
  • 2
  • 15