在 Eclipse 中排除/禁用验证
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/783902/
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
Excluding/Disabling Validation in Eclipse
提问by rjray
I have the (mis)fortune of having a large project source-base in which I am working primarily on PHP and JavaScript. I have to have the full project area as the project root in Eclipse, but unfortunately this includes several directories that drive the validation built into WST/DLTK/etc. nuts.
我有幸拥有一个大型项目源代码库,我主要在其中研究 PHP 和 JavaScript。我必须将完整的项目区域作为 Eclipse 中的项目根目录,但不幸的是,这包括驱动内置于 WST/DLTK/etc 中的验证的几个目录。坚果。
I have tried disabling all validators in the project properties. I have gone into the validators one at a time and added rules to the "Exclude Group" set to exclude the specific folders. I have removed the folders from the PHP build path in the project properties. And yet, my Problems view/tab is still littered with thousands of red flags that stem mostly from a folder that we use to keep copies of external elements (Apache, PHP, etc.). You know, typical "have a copy of the specific versions we currently use" sort of thing.
我尝试禁用项目属性中的所有验证器。我一次一个地进入验证器,并将规则添加到“排除组”集以排除特定文件夹。我已经从项目属性中的 PHP 构建路径中删除了文件夹。然而,我的问题视图/选项卡仍然充斥着成千上万的危险信号,这些危险信号主要来自我们用来保存外部元素(Apache、PHP 等)副本的文件夹。您知道,典型的“拥有我们当前使用的特定版本的副本”之类的事情。
The signal-to-noise ratio is so bad that I'm unable to use the view at all, which is a shame. If I'm not going to have the benefits of the IDE, I might as well be using vim for this (I use it for other stuff, but for this codebase a good IDE is a better choice, providing I can get it to work). It seems to me that it would be an obvious feature to be able to right-click a folder in a project and select "Exclude from Validation", but alas there is no such feature. Is there another way to get the validators (PHP, HTML, etc.) to ignore the folders I need ignored?
信噪比太差了,我根本无法使用视图,这是一种耻辱。如果我不打算使用 IDE 的好处,我可能会为此使用 vim(我将它用于其他东西,但对于这个代码库,一个好的 IDE 是更好的选择,前提是我可以让它工作)。在我看来,能够右键单击项目中的文件夹并选择“从验证中排除”将是一个明显的功能,但可惜没有这样的功能。是否有另一种方法可以让验证器(PHP、HTML 等)忽略我需要忽略的文件夹?
回答by Yusuf K.
Tried solution;
尝试过的解决方案;
- Right click project
- Select properties
- Select validation
- Check Enable Project specific settings
- On the XML Validator row, click the '...' button
- Select Exclude Gruop
- Click Add rule
- Select 'Folder or file name'
- Click Next
- Select files or folder which are not validated.
- Click Finish
- Click OK
- Click OK
- 右键单击项目
- 选择属性
- 选择验证
- 选中启用项目特定设置
- 在 XML Validator 行上,单击“...”按钮
- 选择排除组
- 单击添加规则
- 选择“文件夹或文件名”
- 点击下一步
- 选择未经验证的文件或文件夹。
- 单击完成
- 单击确定
- 单击确定
This solved my problem. Because eclipse validation gives error for generated GWT files.
这解决了我的问题。因为 Eclipse 验证会为生成的 GWT 文件提供错误。
Best regards.
此致。
回答by Wilhelm Kleu
I came upon this question while looking for the same answer. I will list the steps I did here and hopefully it will help someone in the future.
我在寻找相同答案时遇到了这个问题。我将列出我在这里所做的步骤,希望它会在将来对某人有所帮助。
I am using Eclipse 4.1 and I do the following to exclude validation for specific xml files. I am sure if you configure the different validators it will work for other files as well.
我正在使用 Eclipse 4.1,我执行以下操作以排除对特定 xml 文件的验证。我相信如果您配置不同的验证器,它也适用于其他文件。
Go to Preferences -> Validation Find the Validator you wish to change and select settings (not all of the validators have settings, hopefully yours do).
转到 Preferences -> Validation 找到您想要更改的验证器并选择设置(并非所有验证器都有设置,希望您的设置)。
In the settings you can add an Exclude Group where you can add a rule to specify to exclude the validator for specific extensions, folder or file name, project nature, facet or content type.
在设置中,您可以添加一个排除组,您可以在其中添加规则以指定排除特定扩展名、文件夹或文件名、项目性质、方面或内容类型的验证器。
回答by Garrett Griffin
I have Eclipse for PHP Developers and I was dealing with the same issue.
我有面向 PHP 开发人员的 Eclipse,我正在处理同样的问题。
In addition tot he excellent answers above, I have one more suggestion.
除了上述出色的答案之外,我还有一个建议。
My first recommendation is not to use Aptana unless you actually want those validators (as they are nearly impossible to turn off from my experience).
我的第一个建议是不要使用 Aptana,除非你真的想要这些验证器(因为根据我的经验,它们几乎不可能关闭)。
Beyond that, go to File -> Properties -> Builders, and deselect "Validation" and "Script Builder" and "JavaScript Validator".
除此之外,转到 File -> Properties -> Builders,然后取消选择“Validation”和“Script Builder”和“JavaScript Validator”。
So far it's helped speed up some operations tremendously.
到目前为止,它已帮助极大地加快了某些操作的速度。
I also recommend disabling "Automatic Build". Because you're using PHP, the odds that you actually need it to build anything if you don't want validation is slim.
我还建议禁用“自动构建”。因为您使用的是 PHP,所以如果您不想要验证,您实际上需要它来构建任何东西的可能性很小。
In the main menu, go to Project and uncheck "Build Automatically". You will want to build your project every now and then by right clicking on the project and selecting "Build Project".
在主菜单中,转到项目并取消选中“自动构建”。您需要时不时地通过右键单击项目并选择“构建项目”来构建项目。
All the above steps have helped me get the basic editor, which is exactly what I wanted.
以上所有步骤都帮助我获得了基本的编辑器,这正是我想要的。
回答by Nir O.
It is not really possible to select a directory, at least under Windows.
After having pressed Preferences->Validation->Settings->Add Exclude Group->Add Rule->Folder or filename->Browse Folder->(selecting some directory)->[OK]
The "Browse for folder" dialog is being closed, with the "File or folder" field staying empty.
选择目录是不可能的,至少在 Windows 下是这样。
按下首选项->验证->设置->添加排除组->添加规则->文件夹或文件名->浏览文件夹->(选择某个目录)->[确定]
“浏览文件夹”对话框正在关闭,“文件或文件夹”字段保持为空。
回答by Pavel Horal
I used to exclude resources from validation via project specific Exclude Group
(as the most answer here suggests). But in case anyone is still having problems with disabling validation for a specified folder in 2014 - just mark the folder resource as Derived
:
我曾经通过特定于项目的验证排除资源Exclude Group
(正如这里的大多数答案所暗示的那样)。但是,如果有人在 2014 年禁用指定文件夹的验证仍有问题 - 只需将文件夹资源标记为Derived
:
This should disable validation for that folder.
这应该禁用对该文件夹的验证。
If you are using EGIT you might also want to disable automatic inclusion of derived resources in .gitignore
:
如果您正在使用 EGIT,您可能还想禁用派生资源的自动包含.gitignore
:
回答by Lau
I had the same problem with the web app i'm developping. I ended up disabling automatic build, and building once a day (Project->Build automatically), that way i still get the benefits of code completion from libraries, while speeding up the program on older computers.
我正在开发的网络应用程序遇到了同样的问题。我最终禁用了自动构建,并每天构建一次(项目-> 自动构建),这样我仍然可以从库中获得代码完成的好处,同时加快旧计算机上的程序速度。
回答by Simon White
When I excluded files from validation for the project, my setting didn't seem to be recognised until I restarted Eclipse and cleaned the project.
当我从项目验证中排除文件时,我的设置似乎没有被识别,直到我重新启动 Eclipse 并清理了项目。
回答by Dave Robinson
I found in the project properties there is a Builders category. In the list of builders I had a JavaScript Builder. I deselected this builder and all my annoying javascript validation woes went away.
我发现在项目属性中有一个 Builders 类别。在构建器列表中,我有一个 JavaScript 构建器。我取消了这个构建器,所有烦人的 javascript 验证问题都消失了。
回答by SWD
this worked for me: Properties > Builders section and unchecking the corresponding box. https://bugs.eclipse.org/bugs/show_bug.cgi?id=317833
这对我有用:Properties > Builders 部分并取消选中相应的框。https://bugs.eclipse.org/bugs/show_bug.cgi?id=317833
seems to be a bug in some versions of eclipse.
似乎是某些版本的 eclipse 中的错误。
回答by Mateng
There are more gloabal validation parameters. You can suspend all validation (or only the ones you don't need) by going to:
有更多的全局验证参数。您可以通过以下方式暂停所有验证(或仅暂停不需要的验证):
Window > Preferences > Validation.
Here, check the box "Suspend all validators".
在这里,选中“暂停所有验证器”框。
Alternatively, uncheck the validators you don't need from the list below.
A full build will be requested which might take some time. But Eclipse will run a lot faster afterwards [But without validation of course]
或者,从下面的列表中取消选中您不需要的验证器。
将请求完整构建,这可能需要一些时间。但是 Eclipse 之后会运行得更快[但当然没有验证]