如何从 Eclipse 中的验证中排除特定文件夹或文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2272237/
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 19:11:47  来源:igfitidea点击:

How to exclude specific folders or files from validation in Eclipse?

eclipse

提问by Serxipc

We have a bunch of malformed XML files used in unit tests to check if our application can handle them.

我们在单元测试中使用了一堆格式错误的 XML 文件来检查我们的应用程序是否可以处理它们。

Eclipse marks this XML files with errors, polluting the "problem view".

Eclipse 将此 XML 文件标记为错误,污染“问题视图”。

Is there a way to exclude a specific folder from Eclipse validators?

有没有办法从 Eclipse 验证器中排除特定文件夹?

采纳答案by Serxipc

In the Validation section of Window > Preferences you can add different rules in settings (...) column, you can add a "Folder or file name rule" in the Exclude Group for XML types.

在窗口 > 首选项的验证部分,您可以在设置 (...) 列中添加不同的规则,您可以在 XML 类型的排除组中添加“文件夹或文件名规则”。

回答by Shanimal

This is what I do to exclude a folder from validation in a project. For me this works for javascript and other warnings/errors.

这就是我从项目中的验证中排除文件夹的方法。对我来说,这适用于 javascript 和其他警告/错误。

  • Right Click Folder
  • Click Resource, ResourceFilters
  • Click "Add"
  • Set the following Exclude All, Files and Folders, All Children, add an asterisk (*) to the File and Folder Attributes input field (highlighted in the image below)
  • 右键单击文件夹
  • 单击资源,资源过滤器
  • 点击“添加”
  • 设置以下 Exclude All、Files and Folders、All Children,在 File and Folder Attributes 输入字段中添加星号 (*)(在下图中突出显示)

Note: In Eclipse Indigo you have to Right click the folder and select properties and then select resource in the left navigation.

注意:在 Eclipse Indigo 中,您必须右键单击文件夹并选择属性,然后在左侧导航中选择资源。

enter image description here

在此处输入图片说明

回答by Nicolas Raoul

  1. Go to Window > Preference > Validation
  2. Find the type of validation you want to disable, for instance XML.
  3. Right-click it and select "Settings":
  1. 转到窗口 > 首选项 > 验证
  2. 找到要禁用的验证类型,例如 XML。
  3. 右键单击它并选择“设置”:

Eclipse validation

Eclipse 验证

  1. In the "Exclude Group", click "Add rule", select "Folder or file name":
  1. 在“排除组”中,点击“添加规则”,选择“文件夹或文件名”:

enter image description here

在此处输入图片说明

回答by hinneLinks

With Eclipse 2018-12 in an Angular-Project, i was able to get rid von validation errors in the folders, npm generates (like node_modules), just by selecting a folder and check the "Derived" check mark under "Resource".

使用 Angular 项目中的 Eclipse 2018-12,我能够摆脱文件夹中的 von 验证错误,npm 生成(如node_modules),只需选择一个文件夹并选中“资源”下的“派生”复选标记即可。

eclipse - ignore validation on folders by check the "Derived" check mark under "Resource"

eclipse - ignore validation on folders by check the "Derived" check mark under "Resource"

After a Project -> Clean the Errors are gone.

在项目 -> 清理之后,错误消失了。

回答by boumbh

Note:I got here because I was searching for an easy way to exclude specific folders from validation in Eclipse. My answer does not work for the specific case detailed in the question (which is about hiding invalid XML files from validation).

注意:我来到这里是因为我正在寻找一种简单的方法来从 Eclipse 中的验证中排除特定文件夹。我的回答不适用于问题中详述的特定案例(这是关于从验证中隐藏无效的 XML 文件)。

How to exclude specific folders or files from validation in Eclipse?

如何从 Eclipse 中的验证中排除特定文件夹或文件?

When the folders is in the build path, and when the annoying issues are only warnings, there is a way that is straight forward:

当文件夹在构建路径中时,当烦人的问题只是警告时,有一种直接的方法:

  • Right Click Folder
  • Properties
  • Java Compiler
  • Check Ignore optional compile problems
  • Ok
  • 右键单击文件夹
  • 特性
  • Java编译器
  • 查看 Ignore optional compile problems
  • 好的

The folders will still be validated, errors will be reported, but all the warnings will be ignored by Eclipse. For example, that's ideal for a folder of generated sources.

文件夹仍将被验证,将报告错误,但 Eclipse 将忽略所有警告。例如,这是生成源文件夹的理想选择。

回答by SLN

you may also adjust the output/view side. So go to Show-Menu of Problem-View and filter Display only for selected Items. enter image description here

您还可以调整输出/视图侧。因此,转到问题视图的显示菜单并仅针对所选项目过滤显示。 enter image description here