Reputation: 43243
I've been trying out IntelliJ IDEA for JavaScript editing, and I like it so far, but I'm having a small problem with a new project.
I can't seem to be able to get IDEA to display the directories in the project directory in the Project view. Even if I manually add a directory, it refuses to display it.
I think this probably has something to do with the fact that it tries to apply Java conventions, but when I imported an old Eclipse project, it showed all directories just fine.
Do I have to use Eclipse to create projects and import in IDEA to get the directories visible, or is there some other trick?
I am using IDEA version 8.1.3, and the code is just a plain bunch of HTML and JavaScript files, not in any kind of a Java environment.
Upvotes: 118
Views: 93767
Reputation: 1399
I had a similar problem, this fixed it:
File -> New -> Module from Existing Sources...
I chose the src folder and then it detected the rest on its own.
If you still have issues, try reimporting project by doing:
File -> New -> Project from Existing Sources...
Upvotes: 0
Reputation: 1
Platform : Intellij2019.3 Macos10.12
Upvotes: 0
Reputation: 16518
In the project explorer window (where all the classes are), switch from "packages" view to "project" view. Then all files, not just classes are displayed.
Upvotes: -3
Reputation: 2080
I've been struggling with this same problem and found another reason why directories may not show up correctly. Make sure the "Content Root" is correct.
On the sources tab you will see the current "Content Root" along with a button to add a new content root.
Make sure that content root is correct. When in the project structure view you will only see files below the "Content Root". I'm fairly new to IntelliJ but I think of the content root as the basedir in ant terms.
These instructions are for IntelliJ 9.x
Hope this helps someone.
Upvotes: 83
Reputation: 43243
It appears I need to manually create a Java module (File->New Module) inside the project to actually see the "proper" directory view. I do wonder why it didn't show up when I created it with the project.
Upvotes: 110
Reputation: 2373
Just me own 2c. I used "New" -> "Module from existing sources" to get IntelliJ to show folders and files from inside a Github Java project. Hope this helps someone.
Upvotes: 0
Reputation: 107
It happens sometime. You need to go to the configuration (Project Settings) and add the Source folder as content root and then possibly set source/resource etc. from the configuration tab. Apply all the changes and you should be done.
Upvotes: 0
Reputation: 40398
Simplest way to do this!
Reading some of the other answers, they require you to go into Project Structure -> Modules and check that the sources are not excluded.
But in my case - there are no modules defined in the project at all, so that didn't help.
To easily create a module for your project and therefore show the folder structure -
Bam! Your Project Pane with the Project view selected should now instantly show the folder structure of your project.
If you have a maven project, you will need to add the root pom.xml in the Maven Projects window.
And if you want to add java to your project later, you should probably configure a JDK also.
Upvotes: 14
Reputation: 199
I had a test folder which wasn't displaying in IntelliJ. It turned out that it had no files in it, IntelliJ was only showing folders that had some files in them. When i manually added files in test folder via Explorer, it reflected back in IDE.
Upvotes: 0
Reputation: 16575
Just use File » New Project » Static Web
. All your files and directories will show up.
Upvotes: 6
Reputation: 1
I think this is happening to you as intellij's Project window has the 'Compact Empty Middle Packages' option as checked by default. You will find this option under Setting section of the Projects tab.
Upvotes: 0
Reputation: 17895
I found the solution thanks to Thurman Sanders and decided to post a more clear answer, in case it helps anyone else. I know an answer like this would have saved me 5 minutes of fumbling around.
Some folders are excluded, by default. In most cases, this is exactly what you want. Other times, you need to see your "build" or "target" folder, for example.
Make Intellij stop excluding the folder you want to see
Upvotes: 26
Reputation: 11
Here is how I was able to "display" all folders in my project:
Somehow get to the Project Settings page (for me it was right-click the project then select Modules)
Make sure the Sources tab is selected
You should see a section in the middle entitled "Excluded Folders" under Source\Folders"
Click on the X next to it to remove it from being excluded and it becomes visible.
Hope it this helps.
Upvotes: 1
Reputation: 1434
Current more straightforward logic:
Upvotes: 30
Reputation: 3495
The same problem had me going crazy for a couple of hours as well, coming from Netbeans where I could just start a new project and import any source tree. My project is PHP/JS and has nothing to do with Java, so it was not intuitive to have to create a Java module, just so I could see my files listed.
I found the solution (covered above) here for more insight.
Upvotes: 1