IntelliJ 不显示项目文件夹

发布于 2024-11-04 07:03:28 字数 153 浏览 1 评论 0原文

我对 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(30

逆光飞翔i 2024-11-11 07:03:34

项目结构=>模块=>选择您的模块 =>路径=>确保选择“继承项目编译输出路径”

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

情深如许 2024-11-11 07:03:34

添加此答案是为了完整性。我使用的是 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.

飘逸的'云 2024-11-11 07:03:34

选择模块设置并进行这些更改,它将

在“文件”>中 起作用项目结构>模块,单击“+”按钮,

根据您的项目特定添加新模块,例如 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

埋葬我深情 2024-11-11 07:03:34

由于我遇到了同样的问题,并且上述方法都不适合我,所以这就是我所做的!我知道这是一个脾气暴躁的解决方案,但至少它终于起作用了!我不确定为什么只有这个方法有效。我的电脑中应该有一些奇怪的缓存?

  1. 我确实关闭了 IntelliJ
  2. 我确实从项目中完全删除了 .idea 文件夹
  3. 我确实将文件夹 demo-project 移动到 demo-project-temp
  4. 我确实创建了一个新的空文件夹 demo-project
  5. 我确实使用 intelliJ 打开了这个空文件夹,
  6. 我确实移动了所有内容 demo-project-temp。不要忘记也移动隐藏文件
  7. 按右键单击“同步”到您的项目
  8. 您现在应该看到所有文件和文件夹!
  9. 现在您还可以安全地删除文件夹 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?

  1. I did close IntelliJ
  2. I did completely remove the .idea folder from my project
  3. I did move the folder demo-project to demo-project-temp
  4. I did create a new empty folder demo-project
  5. I did open this empty folder with intelliJ
  6. I did move all the content demo-project-temp. Don't forget to also move the hidden files
  7. Press right click "Synchronize" to your project
  8. You should see all the files and folders now!
  9. 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
自由如风 2024-11-11 07:03:34

对我来说,当我在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.

杯别 2024-11-11 07:03:34

我刚刚解决了这个问题,而不必在 WebStorm 中删除 .idea 文件夹(因此必须重新配置工作区),但我认为对于 IntelliJ 和其他JetBrains IDE。

首先,关闭 IDE 并备份 .idea 文件夹。

.idea 文件夹中应该有 .iml 文件,其中包含您的项目名称。就我而言,它是 ClientApp.iml。该文件定义了哪些目录属于该项目、哪些目录应被排除等。请注意 .idea 文件夹中该文件的名称。

接下来,打开 modules.xml 文件。它应该看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/.idea/ClientApp.iml" filepath="$PROJECT_DIR$/.idea/ClientApp.iml" />
    </modules>
  </component>
</project>

检查 fileurlfilepath 是否与您的 .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's ClientApp.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:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/.idea/ClientApp.iml" filepath="$PROJECT_DIR$/.idea/ClientApp.iml" />
    </modules>
  </component>
</project>

Check if fileurl and filepath 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.

难忘№最初的完美 2024-11-11 07:03:33

我有一个更好的解决方案,对我有用,也可能对你有用。无需删除整个 .idea 文件夹,因为这样您就会丢失整个项目。
您可能只是不小心排除了项目设置中的所有文件夹。
我还发现项目文件夹消失了。我试图找出如何禁用索引,所以我查看了项目设置 ->模块和我单击“排除”,看看是否可以将整个项目添加到那里以忽略它进行索引。它没有做任何事情,我无法将文件夹拖放到“排除”下。我没有意识到的是,只需单击“排除”,IntelliJ 就会自动将文件夹移动到“排除”,并且所有文件夹都会在项目资源管理器中消失。 “排除”按钮将背景更改为灰色,这意味着排除已激活。这是一个非常糟糕的用户界面,因为它很难被注意到,并且单击此按钮会对您的项目产生深远的影响。

修复:

  1. 打开项目设置->模块
  2. 如果突出显示“排除”,请单击它
  3. 单击“应用”或“关闭

结果”:
项目中的文件夹再次出现

非常糟糕糟糕的 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:

  1. Open Project Settings -> Modules
  2. If Excluded is highlighted, click on it
  3. 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.

不离久伴 2024-11-11 07:03:33

对我来说,从项目目录中删除 .idea 文件夹是有效的。

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

可爱暴击 2024-11-11 07:03:33

即使已经过去了 5 年,并且有了一定的想法经验,我仍然总是遇到这个问题。这是最简单的解决方案。

  • 关闭 Idea
  • 删除 .idea
  • 启动 Idea 并打开项目而不是导入项目

然后,打开框架的conf文件,例如pom.xmlbuild.sbtbuild.gradle 等,它会自动提示导入项目,当你点击完成后,你的项目大部分是设置正确。

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.

青巷忧颜 2024-11-11 07:03:33

删除 .idea 文件夹对我来说还不够。

这似乎源于一些 git 问题。

我必须

  1. 关闭 PyCharm
  2. **/.idea 添加到 .gitignore
  3. 删除 .idea 文件夹
  4. 打开 PyCharm

Deleting the .idea folder wasn't enough for me.

This seemed to originated from some git issue.

I had to

  1. Close PyCharm
  2. Add **/.idea to .gitignore
  3. Delete the .idea folder
  4. Open PyCharm
勿忘初心 2024-11-11 07:03:33

从 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.

枕梦 2024-11-11 07:03:33

操作系统:Mac && IDE:IntelliJ &&项目:Maven 构建

  1. 导航到“文件”>“项目结构”>“模块”。
  2. 在右侧区域;将出现模块列表。
  3. 删除默认选定的一项并关闭 IntelliJ。
  4. 下一步再次打开; IntelliJ 会询问您是否要处理该项目
    作为 Maven 项目。
  5. 接受该弹出窗口,您就可以开始了。

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

  1. Navigate to File>Project Structure>Modules.
  2. In right-hand area; list of modules would be present.
  3. Delete the default one selected and close IntelliJ.
  4. Next Open again; IntelliJ will ask if you want to treat the project
    as Maven project.
  5. Accept that popup and you are good to go.
清风无影 2024-11-11 07:03:33

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.

神仙妹妹 2024-11-11 07:03:32

我是 IntelliJ IDEA 2016.2 的新用户。当我第一次运行该程序时,我打开了一个现有项目,并遇到了同样的问题,即它仅在 1. 项目面板中显示根目录中的文件,但不显示项目文件夹(可扩展的树状结构)。

最初,我尝试进入“项目设置”>“模块,其中未列出模块。我单击 (+),并尝试选择我的根文件夹,但它不会选择该文件夹。

所以我然后用以下步骤解决了这个问题:

  • 退出 IntelliJ
  • 删除现有的 .idea 文件夹(即 rm -rf .idea
  • 重新启动 IntelliJ
  • 验证项目根文件夹现在出现(在 Project Settings > Modules 中) )
  • 切换工具栏按钮(即 1. 项目结构)以显示在左侧边栏上(单击查看 > 工具栏按钮直到出现勾号)
  • 单击1。项目结构工具栏按钮,直到其侧边栏显示
  • 单击项目根目录名称左侧的箭头图标,该图标显示以展开树文件夹结构

更新2017年9月2日:如果您添加了模块SDK并且它添加了项目根目录的子目录中的 .iml 文件会导致其加载模块子目录,那么您可能需要通过以下方式修改该 .iml 文件:追加/.. 如下所示。

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

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$/..">
树深时见影 2024-11-11 07:03:32
  1. 不必完全退出 Intellij 即可完成这项工作。只需关闭您打开的项目即可。 (您可以打开任何其他项目以避免完全关闭它)

  2. 转到项目安装目录并删除“.idea”文件夹。

  3. 重新打开项目。

那应该解决它。它在 2018 年 5 月对我有用。

  1. 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)

  2. Go to the directory where you have your project installed and delete the ".idea" folder.

  3. Reopen the Project.

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

深巷少女 2024-11-11 07:03:32

尝试重新导入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.

我只土不豪 2024-11-11 07:03:32

将“项目”下拉列表更改为“项目文件”

IntelliJ 示例

如果文件后面仍然有黄色突出显示,您可能需要遵循上面的 #2 答案 (https://stackoverflow.com/a/28375299/3769076)。黄色突出显示表示这些文件不是项目的一部分。您可以通过创建一个模块来解决这个问题,如他们的答案中所述。

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

IntelliJ Example

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.

素年丶 2024-11-11 07:03:32

查看答案

无法在 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 codeenter image description here

那小子欠揍 2024-11-11 07:03:32

删除 .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.

孤君无依 2024-11-11 07:03:32

我已经删除了 .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.

坐在坟头思考人生 2024-11-11 07:03:32

我使用了 WebStorm 中的 IDE 修复功能,没有删除 .idea,以便使文件夹再次显示。

输入图像描述这里

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

enter image description here

櫻之舞 2024-11-11 07:03:32

当我删除 .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.

挽梦忆笙歌 2024-11-11 07:03:32
  1. .idea 文件夹备份到 zip 文件中
  2. 删除 .idea 文件夹
  3. 重新打开项目
  4. 关闭项目
  5. 将备份文件提取到新生成的 .idea 中文件夹
  6. 重新打开项目
  7. 赞美太阳 ☀️ \[T]/
  1. Backup the .idea folder into a zip file
  2. Delete .idea folder
  3. Reopen the project
  4. Close the project
  5. Extract backup files into the new fresh generated .idea folder
  6. Reopen the project
  7. Praise the sun ☀️ \[T]/
弃爱 2024-11-11 07:03:32

我有一个 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
三生路 2024-11-11 07:03:31

因此,在问了另一个问题后,有人帮我在 File > 下弄清楚了这一点。项目结构>模块,那里应该有东西。如果它是空的(显示“Nothing to show”),请执行以下操作:

  1. 文件>中项目结构>模块,单击“+”按钮,
  2. Enter(因为奇怪的是它不允许我单击“新模块”)
    步骤 2
  3. 在弹出的窗口中,单击“...”下一步按钮,将您带到内容根目录。找到您的根文件夹并选择它
    步骤 3 第 1 部分 步骤 3
  4. 单击“确定”按钮
  5. 忽略任何表明该名称已被使用的警告

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:

  1. In File > Project Structure > Modules, click the "+" button,
  2. Press Enter (because weirdly it won't let me click on "New Module")
    step 2
  3. 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
    step 3 part 1step 3
  4. Click the "ok" button
  5. Ignore any warning that says the name is already in use
夏日落 2024-11-11 07:03:31

我也有这个问题。
这是与 .idea 有关的事情,只需删除它并重新启动 IntelliJ

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

单身狗的梦 2024-11-11 07:03:31

我转到文件项目结构模块,单击+,然后导入模块,找到我的根文件夹,选择它并且它起作用了。

对于 IntelliJ 14。

I went to FileProject StructureModules, clicked on + and then Import Module, found my root folder, selected it and it worked.

For IntelliJ 14.

并安 2024-11-11 07:03:31

这里的很多答案都建议删除 .idea。这对我来说只有大约 50% 的时间有效。简单的重新启动大约有 10% 的成功率。将事物重新添加为模块是一种可怕的黑客行为,会导致其他问题,例如丢失一些仅项目设置。

我还发现这个解决方案有效:

  1. File ->修复 IDE

enter此处的图像描述

  1. 右下角会显示一个对话框。单击“重新扫描项目索引”

在此处输入图像描述

  1. 显示下一个对话框时,单击“重新打开项目”:

在此处输入图像描述

  1. 现在应该显示目录。

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:

  1. File -> Repair IDE

enter image description here

  1. A dialog shows in the bottom right. Click "Rescan Project indexes"

enter image description here

  1. When the next dialog shows, click Reopen Project:

enter image description here

  1. Directories should show now.
踏雪无痕 2024-11-11 07:03:31
  1. 关闭intellij
  2. 删除.idea文件夹
  3. 重新启动intellij
  4. 单击导入,选择您的项目
  5. 从现有源创建项目,单击下一步,下一步,下一步

您应该可以开始了。

  1. close intellij
  2. delete .idea folder
  3. restart intellij
  4. click import, select your project
  5. create project from existing sources, click next, next, next

And you should be good to go.

可可 2024-11-11 07:03:30

我必须退出 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文