IntelliJ 不显示项目文件夹
我对 IntelliJ 有疑问。它在左侧的项目视图中没有显示任何文件夹。 我的设置是“查看方式:项目” 我该如何管理它以便再次显示文件夹和包? 我没有任何线索,因为我没有改变任何选项!
我正在使用 IntelliJ 10.0.3。 我正在从事 Maven Lift 项目。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(30)
项目结构=>模块=>选择您的模块 =>路径=>确保选择“继承项目编译输出路径”
Project Structure => Modules => Select your module => Paths => Make sure "Inherit project compile output path" is selected
添加此答案是为了完整性。我使用的是 15.0.6 并遇到了这个问题。我尝试从 Maven 或 Gradle 导入模块并完成该过程,但该模块没有出现。我尝试删除 .idea 文件并重新启动。卸载并安装最新版本(社区 2016.2)解决了该问题。
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.
选择模块设置并进行这些更改,它将
在“文件”>中 起作用项目结构>模块,单击“+”按钮,
根据您的项目特定添加新模块,例如 Java 或 RUBY 等
然后申请就ok了
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
由于我遇到了同样的问题,并且上述方法都不适合我,所以这就是我所做的!我知道这是一个脾气暴躁的解决方案,但至少它终于起作用了!我不确定为什么只有这个方法有效。我的电脑中应该有一些奇怪的缓存?
.idea
文件夹demo-project
移动到demo-project-temp
demo-project
demo-project-temp
。不要忘记也移动隐藏文件demo-project-temp
。如果您使用的是 Linux 或 MAC,请使用 rmdir demo-project-temp 来确保您的文件夹为空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?
.idea
folder from my projectdemo-project
todemo-project-temp
demo-project
demo-project-temp
. Don't forget to also move the hidden filesdemo-project-temp
. If you are on linux or MAC do it withrmdir demo-project-temp
just to make sure that your folder is empty对我来说,当我在react-native项目中将
Project SDK
设置为JAVA SDK 14时,就会发生这种情况。取消设置后,所有文件夹将再次显示。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.我刚刚解决了这个问题,而不必在 WebStorm 中删除
.idea
文件夹(因此必须重新配置工作区),但我认为对于 IntelliJ 和其他JetBrains IDE。首先,关闭 IDE 并备份
.idea
文件夹。在
.idea
文件夹中应该有.iml
文件,其中包含您的项目名称。就我而言,它是ClientApp.iml
。该文件定义了哪些目录属于该项目、哪些目录应被排除等。请注意.idea
文件夹中该文件的名称。接下来,打开
modules.xml
文件。它应该看起来像这样:检查
fileurl
和filepath
是否与您的.iml
文件的名称匹配,如果没有修复文件名,保存并重新-打开你的IDE。对我来说,这解决了问题。其他答案中的人是正确的,这是模块的问题。在 2024 年的 WebStorm 中,“设置”中没有模块,我认为它被重命名为“目录”。当我以这种方式添加项目根目录时,项目被重命名,并且所有文件夹设置(测试、资源、排除)都丢失了,因此修复
.xml
文件似乎是一个更好的选择。I've just solved this problem without having to delete the
.idea
folder (and thus having to re-configure the workspace), in WebStorm, but I assume it's going to be the same for IntelliJ and other JetBrains IDEs.First, close your IDE and backup the
.idea
folder.In
.idea
folder there should be.iml
file with the name of your project. In my case it'sClientApp.iml
. This file defines, which directories belong to the project, which should be excluded etc. Note the name of this file in your.idea
folder.Next, open
modules.xml
file. It should look something like this:Check if
fileurl
andfilepath
match name of your.iml
file, if not fix the filenames, save and re-open your IDE. For me, this fixed it.People in other answers are right that this is a problem with Modules. In WebStorm in 2024, there are no modules in Settings, I think it was renamed to Directories. When I added the project root this way, the project got renamed and all folder settings (test, resources, excluded) were lost, so fixing the
.xml
file seems like a better option.我有一个更好的解决方案,对我有用,也可能对你有用。无需删除整个
.idea
文件夹,因为这样您就会丢失整个项目。您可能只是不小心排除了项目设置中的所有文件夹。
我还发现项目文件夹消失了。我试图找出如何禁用索引,所以我查看了项目设置 ->模块和我单击“排除”,看看是否可以将整个项目添加到那里以忽略它进行索引。它没有做任何事情,我无法将文件夹拖放到“排除”下。我没有意识到的是,只需单击“排除”,IntelliJ 就会自动将文件夹移动到“排除”,并且所有文件夹都会在项目资源管理器中消失。 “排除”按钮将背景更改为灰色,这意味着排除已激活。这是一个非常糟糕的用户界面,因为它很难被注意到,并且单击此按钮会对您的项目产生深远的影响。
修复:
结果”:
项目中的文件夹再次出现
非常糟糕糟糕的 UI 设计!源和排除按钮看起来像选项卡,但实际上它们的作用是“复选框”!
请注意,仅单击“源”或“排除”似乎是一个无辜的选项卡选择,没有任何明显的效果,但它具有深远的影响,基本上是在构建过程中添加或删除文件。
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:
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.
对我来说,从项目目录中删除 .idea 文件夹是有效的。
for me removing the
.idea
folder from the project directory worked.即使已经过去了 5 年,并且有了一定的想法经验,我仍然总是遇到这个问题。这是最简单的解决方案。
打开项目
而不是导入项目
然后,打开框架的conf文件,例如
pom.xml
或build.sbt
或build.gradle
等,它会自动提示导入项目
,当你点击完成后,你的项目大部分是设置正确。Even after 5 years, and having some experience with idea, I still have this problem all the times. Here is the simplest solution.
open project
instead ofimport project
And then, open conf file for your framework, like
pom.xml
orbuild.sbt
orbuild.gradle
etc and it will automatically prompts toimport project
and when you click and when it finishes, your project is mostly setup correct.删除
.idea
文件夹对我来说还不够。这似乎源于一些 git 问题。
我必须
**/.idea
添加到.gitignore
.idea
文件夹Deleting the
.idea
folder wasn't enough for me.This seemed to originated from some git issue.
I had to
**/.idea
to.gitignore
.idea
folder从 intellij 15 (v143) 升级到 2016.3 (v163) 后,我遇到了问题。我在启动时也遇到了一个间歇性错误,内容是“加载错误:未定义的路径变量”,变量名称神秘。
经过无数次尝试此处介绍的大多数解决方案(重新导入项目、使缓存无效并重新启动、检查项目结构和路径...),唯一有效的方法是完全重新安装 Intellij (删除 ~/.idea* ~/ .IntellijIdea*)并在“您想迁移以前的设置”问题中选择“否”。
这终于奏效了。
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.
操作系统:Mac && IDE:IntelliJ &&项目:Maven 构建
作为 Maven 项目。
OS:Mac && IDE: IntelliJ && Project: Maven build
as Maven project.
Intellij 在解决所有依赖关系后导入项目。就我而言,它无法解决某些模块的依赖关系并卡在那里。我必须将 Maven
settings.xml
从本地存储库复制到默认的.m2
文件夹,以便将其指向正确的本地存储库。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.我是 IntelliJ IDEA 2016.2 的新用户。当我第一次运行该程序时,我打开了一个现有项目,并遇到了同样的问题,即它仅在 1. 项目面板中显示根目录中的文件,但不显示项目文件夹(可扩展的树状结构)。
最初,我尝试进入“项目设置”>“模块,其中未列出模块。我单击 (+),并尝试选择我的根文件夹,但它不会选择该文件夹。
所以我然后用以下步骤解决了这个问题:
rm -rf .idea
)更新2017年9月2日:如果您添加了模块SDK并且它添加了项目根目录的子目录中的
.iml
文件会导致其加载模块子目录,那么您可能需要通过以下方式修改该.iml
文件:追加/..
如下所示。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:
rm -rf .idea
)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.您不必完全退出 Intellij 即可完成这项工作。只需关闭您打开的项目即可。 (您可以打开任何其他项目以避免完全关闭它)
转到项目安装目录并删除“.idea”文件夹。
重新打开项目。
那应该解决它。它在 2018 年 5 月对我有用。
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.
尝试重新导入Maven项目。另请确保项目目录名称未在
Settings | 中排除。文件类型 |忽略文件和文件夹
。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
.将“项目”下拉列表更改为“项目文件”
如果文件后面仍然有黄色突出显示,您可能需要遵循上面的 #2 答案 (https://stackoverflow.com/a/28375299/3769076)。黄色突出显示表示这些文件不是项目的一部分。您可以通过创建一个模块来解决这个问题,如他们的答案中所述。
Change the "Project" dropdown to be "Project Files"
If the files still have a yellow highlighting behind them you may need to follow the #2 answer above (https://stackoverflow.com/a/28375299/3769076). The yellow highlighting indicates the files are not part of the project. You can remedy this by creating a module as explained in their answer.
查看答案
无法在 IntelliJ IDEA 中查看项目文件夹< /a>
这可能是因为该项目没有定义任何模块。尝试通过点击“文件”>“添加现有源代码”新的>从现有源模块并选择源代码项目的父目录
Check out answer at
Can't see project folders in IntelliJ IDEA
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
删除
.idea/workspace.xml
对我有用。关闭项目,删除.idea/workspace.xml
,然后再次打开项目。我使用的是2019.1版本。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.我已经删除了 .idea 文件夹。关闭 ItelliJ 并重新启动以打开同一项目。
它要求添加内容根目录。这对我有用。
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.
我使用了 WebStorm 中的 IDE 修复功能,没有删除 .idea,以便使文件夹再次显示。
I used the IDE Repair feature in WebStorm, without deleting .idea, in order to get the folders to show again.
当我删除 .idea 文件夹时,我遇到了同样的问题。
但是,当我尝试无效并重新启动时,.idea 文件夹再次创建,但文件夹仍然没有显示。
我必须 1.关闭 IntelliJ,2.删除 .idea 文件夹,3.启动 IntelliJ
这解决了问题。
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.
.idea
文件夹备份到 zip 文件中.idea
文件夹.idea
中文件夹\[T]/
.idea
folder into a zip file.idea
folder.idea
folder\[T]/
我有一个 nodeJs 项目,在删除 /[project_name].iml 文件后丢失了我的文件夹。
这恢复了文件夹,同时保留了我的其他项目设置:
Project Settings >模块
+ 添加内容根
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
因此,在问了另一个问题后,有人帮我在 File > 下弄清楚了这一点。项目结构>模块,那里应该有东西。如果它是空的(显示“Nothing to show”),请执行以下操作:
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:
我也有这个问题。
这是与 .idea 有关的事情,只需删除它并重新启动 IntelliJ
I had this issue as well.
It is something do with .idea just delete it and restart IntelliJ
我转到文件→项目结构→模块,单击+,然后导入模块,找到我的根文件夹,选择它并且它起作用了。
对于 IntelliJ 14。
I went to File → Project Structure → Modules, clicked on + and then Import Module, found my root folder, selected it and it worked.
For IntelliJ 14.
这里的很多答案都建议删除
.idea
。这对我来说只有大约 50% 的时间有效。简单的重新启动大约有 10% 的成功率。将事物重新添加为模块是一种可怕的黑客行为,会导致其他问题,例如丢失一些仅项目设置。我还发现这个解决方案有效:
A lot of answers here suggest deleting
.idea
. this works for me only about 50% of the time. A simple restart works about 10% of the time. Re-adding things as a module is an awful hack that causes other issues like losing some project-only settings.I've also found this solution to work:
您应该可以开始了。
And you should be good to go.
我必须退出 Intellij 并删除
.idea
文件夹(我先把它藏起来,以防万一)。然后我重新打开了该项目,这对我有用。不要忘记在此之前保存您的配置(例如调试/运行配置),因为它们也会被删除。
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.