ChatGPT解决这个技术问题 Extra ChatGPT

IntelliJ does not show project folders

I have an issue with IntelliJ. It doesn't show any folders in my project view on the left. My setting is "View As: Project" How can I manage it so that the folders and packages are shown again? I don't have any clue because I didn't change any options!

I'm using IntelliJ 10.0.3. I am working on a Maven Lift Project.

i know there are solutions already provided. But this is how i got the issue in the first place. I was checking out the git project and before it finishes, opened the project in intellij. So the .idea folder was in a corrupt state and intellij does not refresh it automatically. Either you can delete the .idea folder and open again or try doing a synchronize. hope it helps.
The same thing happened to me after I deleted the .idea folder
IntelliJ Community 2018.1 - Simply deleting the entire .idea folder and then re-opening root folder from the IDE fixed this issue for me. IntelliJ rebuilt and reindexed the entire project.
I have remove git cloned folder. When I clone back my repository and open in IntelliJ it doesn't show the folders. So, after figure out I found .idea folder is missing modules.xml & terrafuse.iml. So, I copy this two files from .idea folder of another project and restarted the IntelliJ which in turn start working normally.
Still a bug in IntelliJ 2021.2

D
Danny Bullis

So after asking another question, someone helped me figure out that under File > Project Structure > Modules, there's supposed to be stuff there. If it's empty (says "Nothing to show"), do the following:

In File > Project Structure > Modules, click the "+" button, Press Enter (because weirdly it won't let me click on "New Module") In the window that pops up, click on the "..." next button which takes you to the Content root. Find your root folder and select it Click the "ok" button Ignore any warning that says the name is already in use


I had to import a module
This was 95% of the solution for me. I had to "Add Content Root" on that screen. Then for some reason all the folders magically appeared.
This is something that has always bothered me, when you make a new project from existing source, everything works great. But when you make a new project, IDEA is constantly "this file isn't part of the project...". Now it all makes sense.
Had to select "java" and click on "next" in the 3rd step.
I can't believe how many times I have to do this with Intellij. Is there any way to get it to persist? I've got to be doing something contrary to Intellij's intent, because existing projects helpfully do this to me periodically.
C
CKey

I had to quit Intellij and remove the .idea folder (I stashed it first, just in case). I then re-opened the project and that worked for me. Don't forget to save your configuration (e.g. debug / run configurations) before that, because they will also be deleted.


I think it's still a bug in IDEA 1 year later?
Similar, but had to delete the .iml file too.
Worked for me too. Better than creating a new module without a reason.
Still happening in Jan 2018
Still there in 2021 Deleting .idea works like a charm!
R
RMati

I had this issue as well. It is something do with .idea just delete it and restart IntelliJ


rm -rf .idea && idea . (2021 still a bug)
@JorgeTovar + apt install vim :)
R
Raghvendra Singh

I went to File -> Project Structure -> Modules clicked on + and then import module found my root folder and selected it.

It worked.

For IntelliJ 14


This worked for me on Intellij ultimate on macos in 2018 :)
This worked for me in Ubuntu 16.04. Perfect answer.
This worked for me on MacOS Intellij 2021.3.1
S
Stuphan

I am a new user of IntelliJ IDEA 2016.2. I opened an existing project when I first ran the program and had the same issue whereby it only showed files in the root directory in the 1. Project panel, but not the project folders (expandable tree-like structure).

Initially, I tried going to Project Settings > Modules, where no modules were shown listed. I clicked (+), and tried to select my root folder, but it wouldn't select the folder.

So I then solved it with these steps instead:

Exit IntelliJ

Delete the existing .idea folder (i.e. rm -rf .idea)

Restart IntelliJ

Verified that the project root folder now appeared (in Project Settings > Modules)

Toggle On the toolbar buttons (i.e. 1. Project Structure) to display on the left sidebar (clicked View > Toolbar Buttons until tick appears)

Click 1. Project Structure toolbar button until its sidebar is revealed

Click the arrow icon on the left of your project's root directory name that appears to expand the tree folder structure

UPDATE 2nd Sept 2017: If you've added a Module SDK and it added a .iml file within a subdirectory of the root of your project that causes it to load the module subdirectory, then it may be necessary for you to modify that .iml file by appending /.. as shown below.

  <component name="NewModuleRootManager" inherit-compiler-output="true">
    <exclude-output />
    <content url="file://$MODULE_DIR$/..">

i
ionut

close intellij delete .idea folder restart intellij click import, select your project create project from existing sources, click next, next, next

And you should be good to go.


C
CrazyCoder

Try to re-import the Maven project. Also make sure that the project directory name is not excluded in Settings | File Types | Ignore Files and Folders.


I have the same problem (seen it twice today on different projects). But removing all entries from the "Ignore Files and Folders" setting, doesn't help. What do you mean "re-import"?
@BT try to delete .idea directory and create a new project on top of the existing files or import pom.xml if your project is Maven based. If the issue persists, please submit a ticket to the support team.
This happened to me - it's because I was switching branches and in this process I managed to exclude folders.
D
Devner

You don't have to quit Intellij completely to make this work. Simply close the project that you have open. (You can open any another project to avoid closing it completely) Go to the directory where you have your project installed and delete the ".idea" folder. Reopen the Project.

That should fix it. It worked for me in May 2018.


P
Pritam Sadhukhan

I have deleted the .idea folder. Closed ItelliJ and restarted to open the same project.

It asked to add the content root. That worked for me.


H
Harish Gokavarapu

Check out answer at

Can't see project folders in IntelliJ IDEA

https://i.stack.imgur.com/RfTR5.png


In case it is an Eclipse project you can also go to File -> Project Structure... -> Modules -> + -> Import Module -> go to your project root folder and select the .profile from Eclipse (you may need to click the "eye" icon to show hidden files).
S
Samuli Pahaoja

Deleting .idea/workspace.xml worked for me. Close the project, delete .idea/workspace.xml, and open the project again. I was using version 2019.1.


Or just delete the whole .idea folder and open with IntelliJ again
A
Anand

I faced same issue when i deleted the .idea folder.

However, when I tried to invalidate and re-start, the .idea folder got created again but still the folders were not showing up.

I had to 1.close IntelliJ, 2.delete the .idea folder, 3.launch IntelliJ

This fixed the issue.


D
Dezza

I have a better solution that worked for me and it might work for you. No need to delete the whole .idea folder as this way you lose the whole project. It is possible that you just accidentally excluded all folders in project settings. I also found that project folders disappeared. I was trying to find out how to disable indexing, so I was looking at Project Settings -> Modules and I clicked on Excluded to see if I could add the whole project there to ignore it for indexing. It didn't do anything and I couldn't drag and drop the folder under Excluded. What I didn't realize is that simply clicking "Excluded", IntelliJ automatically moves the folder to Excluded and all folders disappeared in Project Explorer. "Excluded" button changes background to gray, which means exclusion is active. This is a very poor user interface because it is hardly noticeable and clicking this button has a far-reaching impact on your project.

Fix:

Open Project Settings -> Modules If Excluded is highlighted, click on it Click Apply or Close

Result: Folders in your project show up again

Really bad bad bad UI design! Source and Excluded buttons look like tabs when they work in fact as "Checkboxes"!

Be careful, just clicking Sources or Excluded seems like an innocent selection of tab without any visible effect, yet it has far-reaching consequences, basically adding or removing files from the build process.


This solution worked for me after the higher ranked answers did not. Seems like there is really more than one correct solution for this problem.
M
Michael Pacheco

Backup the .idea folder into a zip file Delete .idea folder Reopen the project Close the project Extract backup files into the new fresh generated .idea folder Reopen the project Praise the sun ☀️ \[T]/


s
solbs

Change the "Project" dropdown to be "Project Files"

https://i.stack.imgur.com/eNxcy.png

I understand this does not answer the OPs question involving Maven modules, but this is the number 1 search result on Google as of July 2021 when trying to debug why folders are not displaying correctly in IntelliJ


This didn't work for me because Project Files shows all meta files as well, which is a messy workspace.
S
Shanimal

I have a nodeJs project and lost my folders after removing the /[project_name].iml file.

This restored the folders while preserving my other project settings:

Project Settings > Modules

+ Add Content Root


M
Mohammed

for me removing the .idea folder from the project directory worked.


Repeating existing answers doesn't add value to the community.
R
RP-

Even after 5 years, and having some experience with idea, I still have this problem all the times. Here is the simplest solution.

Close Idea

Delete .idea

Start Idea and open project instead of import project

And then, open conf file for your framework, like pom.xml or build.sbt or build.gradle etc and it will automatically prompts to import project and when you click and when it finishes, your project is mostly setup correct.


but if you delete the .idea folder you loose all the project specific configurations
Yes, we loose any specific project settings, but most of the module settings can be recovered if you open pom.xml or build.sbt and use import project feature.
h
habin prasad

OS:Mac && IDE: IntelliJ && Project: Maven build

Navigate to File>Project Structure>Modules. In right-hand area; list of modules would be present. Delete the default one selected and close IntelliJ. Next Open again; IntelliJ will ask if you want to treat the project as Maven project. Accept that popup and you are good to go.


C
Chris Sprague

I used the IDE Repair feature in WebStorm, without deleting .idea, in order to get the folders to show again.

https://i.stack.imgur.com/jHzDt.png


This does the job, though I needed to press the option to reindex the files 2 times without luck, then it prompted me to reopen the project and then it worked.
K
Kirby

Intellij imports the project after resolving all the dependencies. In my case, it was unable to resolve dependencies for some of the modules and was stuck there. I had to copy my Maven settings.xml from local repo to the default .m2 folder in order to point it to the correct local repo.


F
Francis Upton IV

Adding this answer for completeness. I was using 15.0.6 and had this problem. I trued to import a module from Maven or Gradle an it went through the process, but the module did not appear. I tried deleting the .idea file and restarting. Uninstalling and installing the latest version (community 2016.2) addressed the problem.


J
Jagath Gowda

Select the module settings and do these changes, it will work

In File > Project Structure > Modules, click the "+" button,

add new module as per your project specific like Java or RUBY or something then apply and ok


m
mathieu

I had the problem after an upgrade from intellij 15 (v143) to 2016.3 (v163). I also had an intermittent error on startup about a "Load error: undefined path variables" with a cryptic variable name.

After countless attempts at most solutions presented here (reimport the project, invalidate caches & restart, checks of project structure and paths...), the only thing that worked was to completely reinstall Intellij (removing the ~/.idea* ~/.IntellijIdea*) and selecting "No" at the question "would you like to migrate previous settings".

This finally worked.


J
John Skoumbourdis

As I had the same issue and none of the above worked for me, this is what I did! I know it is a grumpy solution but at least it finally worked! I am not sure why only this method worked. It should be some weird cache in my PC?

I did close IntelliJ I did completely remove the .idea folder from my project I did move the folder demo-project to demo-project-temp I did create a new empty folder demo-project I did open this empty folder with intelliJ I did move all the content demo-project-temp. Don't forget to also move the hidden files Press right click "Synchronize" to your project You should see all the files and folders now! Now you can also safely remove the folder demo-project-temp. If you are on linux or MAC do it with rmdir demo-project-temp just to make sure that your folder is empty


K
Kudo

For me, it happens when i set Project SDK as JAVA SDK 14 in a react-native project. Upon unset, all the folders show up again.


Thank you! For me it turns out that WebOS SDK update (which included java) was the source of the problem.
R
RoyalBigMack

Project Structure => Modules => Select your module => Paths => Make sure "Inherit project compile output path" is selected


Could you please elaborate more your answer adding a little more description about the solution you provide?
D
Daniel Werner

I just had the same problem with an SBT project in IntelliJ 2016.2 after removing a globally installed IntelliJ and re-installing in my own home folder (Linux). No files or folders were shown in Project View anymore.

The Project Structure view wouldn't even open, and renaming the .idea folder to .idea.bak and re-importing the project didn't make any difference.

However, what fixed it for me was to reboot Linux. Afterwards it worked again, even with the original .idea folder. Seems this "fix" is not only restricted to the Windows world.


c
chris

If you have a gradle module with the same name as your projects root folder, the gradle import will replace your toplevel module configuration and change your view completely.

Make sure you have no gradle module with the same name as your root directory.


B
Big Al

I encountered this problem when the .idea folder was accidentally added to SVN version control. When I took an update --- blooey! I subsequently removed the .idea folder from version control.