如何阻止 Eclipse 刷新某些目录?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/993545/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:47:30  来源:igfitidea点击:

How do I stop Eclipse from refreshing some dir?

eclipserefresh

提问by Fortepianissimo

Every time I start Eclipse it tries to refresh an entire project, which translates to more than 10 minutes of wait time, not to mention the ridiculous amount of memory it would consume.

每次我启动 Eclipse 时,它​​都会尝试刷新整个项目,这意味着等待时间超过 10 分钟,更不用说它会消耗的大量内存了。

I know there's a global setting to turn off automatic refreshing (General -> Workspace -> Refresh automatically). Is there a way to turn that off on individual directories? The rationale is that some directories are seldom changed in some of my projects.

我知道有一个全局设置可以关闭自动刷新 ( General -> Workspace -> Refresh automatically)。有没有办法在单个目录上关闭它?基本原理是在我的某些项目中很少更改某些目录。

采纳答案by VonC

According to this thread, no:

根据这个线程

  • no settings per projects (for disabling auto-refresh)
  • no settings per directory within one project.
  • 每个项目没有设置(用于禁用自动刷新)
  • 一个项目中的每个目录没有设置。


For more recent versions of Eclipse, as detailed in Eclipse help page, you can use Resource filters(also initially mentioned belowby pcoucke)

对于较新版本的 Eclipse,如Eclipse 帮助页面中所述,您可以使用资源过滤器(也最初由下面提到pcoucke

Resource filters can be created, edited and removed in the File > Properties > Resource > Resources Filtersproperty page for a project or folder resource.

Resource filters only apply to files and/or folders that are implicitly included in the workspace by the refresh operation
An "Exclude" resource filter prevent all files and/or folders that match the filter condition to be included in the workspace during the refresh operation.

可以在File > Properties > Resource > Resources Filters项目或文件夹资源的属性页中创建、编辑和删除资源过滤器。

资源过滤器仅适用于通过刷新操作隐式包含在工作区中的
文件和/或文件夹“排除”资源过滤器可防止在刷新操作期间将所有符合过滤条件的文件和/或文件夹包含在工作区中。

I mentioned an example in "How to have .gitfolders ignored by Eclipse projects"

我在“提到的一个例子如何有.git由Eclipse项目忽略文件夹

resource filter

资源过滤器

回答by Pieter Coucke

For individual directories you can do it by adding Resource filters.

对于单个目录,您可以通过添加资源过滤器来实现。

  1. Right-click a project folder in Project Explorer tree and go to "Properties".
  2. Resource -> Resource Filters.
  3. Add as much exclusion filters for files/folders as you like.
  1. 右键单击项目资源管理器树中的项目文件夹,然后转到“属性”。
  2. 资源 -> 资源过滤器。
  3. 根据需要为文件/文件夹添加尽可能多的排除过滤器。

See this answer: https://stackoverflow.com/a/6321688/1194584

看到这个答案:https: //stackoverflow.com/a/6321688/1194584

回答by Willian Mitsuda

If your problem is the refresh on startup, try: Preferences -> General -> Startup and Shutdown -> Refresh workspace on startup.

如果您的问题是启动时刷新,请尝试:首选项 -> 常规 -> 启动和关机 -> 启动时刷新工作区。

回答by Fortepianissimo

I found an effective hack that can in effect make Eclipse ignore a directory. See Eclipse - Ignore Entire Directories

我发现了一个有效的 hack,它实际上可以使 Eclipse 忽略目录。查看Eclipse - 忽略整个目录

回答by user79878

I ran in to this same problem. When an eclipse project refreshes it seems to want to touch every file regardless of settings. The code base I'm working on has ~70K files, and took nearly 2 minutes to refresh. I eventually redefined the eclipse project to be a much smaller subset of that (~10K files) that has a ~ 1 second refresh. Not ideal, but the long refresh times are intolerable.

我遇到了同样的问题。当一个 eclipse 项目刷新时,它似乎想要触摸每个文件而不管设置如何。我正在处理的代码库有大约 70K 个文件,刷新需要近 2 分钟。我最终将 eclipse 项目重新定义为一个小得多的子集(约 10K 文件),刷新时间约 1 秒。不理想,但长时间的刷新令人无法忍受。

FYI the "Derived" check box and "Exclude from build..." options DON'T prevent a folder from being refreshed.

仅供参考,“派生”复选框和“从构建中排除...”选项不会阻止文件夹刷新。

Note, the computer I'm using is 4-5 years old (Pentium IV processor, 7200 rpm hard drive). I bet one of these newer fast solid state hard drives would dramatically improve refresh times!

请注意,我使用的计算机已有 4-5 年的历史(Pentium IV 处理器,7200 rpm 硬盘驱动器)。我敢打赌,这些较新的快速固态硬盘之一会显着改善刷新时间!

回答by Fabian Steeg

To exclude entire projects, you could close them. Don't know a way for individual directories.

要排除整个项目,您可以关闭它们。不知道单个目录的方法。

回答by Juri

I'm sorry but I don't know anything about such a setting. As one already mentioned you could close the project within Eclipse (once it is open). This prevents the repetitive refreshing on that project. Otherwise I can just give you the suggestion to have 1 workspace per project and not include multiple different projects into the same workspace (unless they are related to each other). This is a much better practice and what I'm doing every day when working with Eclipse. And I didn't experience any problems so far of the type you mentioned.

对不起,我对这样的设置一无所知。正如已经提到的,您可以在 Eclipse 中关闭该项目(一旦它打开)。这可以防止对该项目进行重复刷新。否则,我只能建议您每个项目有 1 个工作区,并且不要将多个不同的项目包含在同一个工作区中(除非它们彼此相关)。这是一个更好的实践,也是我在使用 Eclipse 时每天都在做的事情。到目前为止,我没有遇到您提到的类型的任何问题。

回答by NameNotFoundException

I found out a way to stop auto refreshing at eclipse startup.Below are the steps:-

我找到了一种在 Eclipse 启动时停止自动刷新的方法。以下是步骤:-

Windows->Preferences->(Search Keyword:-Workspace)->General->Startup And ShutDown->Uncheck Referesh workspace on start up.

Windows->Preferences->(Search Keyword:-Workspace)->General->Startup And ShutDown->Uncheck Referesh workspace on start.

Done ...!!! Work like charm for me.

完毕 ...!!!工作对我来说很有魅力。

回答by kepa

Edit the file .project inside the folder .metadata.plugins\org.eclipse.jdt.core.org.eclipse.jdt.core.external.folders of your workspace folder.

编辑工作区文件夹的 .metadata.plugins\org.eclipse.jdt.core.org.eclipse.jdt.core.external.folders 文件夹内的文件 .project 。

Then remove any content between the linkedResources tags.

然后删除linkedResources 标签之间的任何内容。

That worked for me (eclipse-jee-helios-SR2-win32)

这对我有用(eclipse-jee-helios-SR2-win32)

回答by MadMad666

You know what. Just close unused projects and that's was all for me.!

你知道吗。只需关闭未使用的项目,这就是我的全部。!