在 Eclipse 中禁用 Ant 脚本的 DTD 警告?

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

Disable DTD warning for Ant scripts in Eclipse?

eclipseantwarningsdtd

提问by Brian Deacon

I'm using Eclipse Ganymede. Everything works fine, but I have an anal-retentive yearning for a warning-free Problems tab. Right now it (correctly) complains about my Antscripts: "No grammar constraints (DTD or XML schema) detected for the document." Is there any way to turn that off for just those files? Ideally I'd like it to still warn me if my other schema-constrained files were missing the schema declarations.

我正在使用Eclipse Ganymede。一切正常,但我对一个没有警告的问题选项卡有着强烈的渴望。现在它(正确地)抱怨我的Ant脚本:“没有检测到文档的语法约束(DTD 或 XML 模式)。” 有没有办法只为这些文件关闭它?理想情况下,如果我的其他受架构约束的文件缺少架构声明,我希望它仍然警告我。

回答by David Pierre

The simplest is to supply a minimal DTD to shut it up.

最简单的方法是提供一个最小的 DTD 来关闭它。

<!DOCTYPE project>

for ant files

对于蚂蚁文件

回答by BruceR

Being with Brian on the "anal-retentive yearning for a warning-free Problems tab", I finally decided to get serious about solving this. Thanks to Martin's leading, it looks like a done deal.

与布莱恩一起讨论“对无警告问题标签的肛门保持渴望”,我最终决定认真解决这个问题。多亏了马丁的领导,这看起来像是一笔交易。

However, instead of Project -> Properties, it's solvable globally via Windows -> Preferences.

但是,它不是 Project -> Properties,而是可通过 Windows -> Preferences 全局解决。

  1. Select the Validation category in the left pane.
  2. Find the Validator named "XML Validator" (in the right pane) and click its ellipses (...) button.
  3. In the following dialogue, select the "Exclude Group" and click "Add Rule...".
  4. On the first page of the New Filter Rule Wizard, select the Content Type option and click Next>.
  5. Finally, on the Content Type drop down, select "Ant Buildfile".
  6. Click Finish and a couple of OKs and that should take care of existing and future Ant Build file validation warnings.
  1. 在左窗格中选择验证类别。
  2. 找到名为“XML Validator”的验证器(在右侧窗格中)并单击其省略号 (...) 按钮。
  3. 在以下对话框中,选择“排除组”并单击“添加规则...”。
  4. 在 New Filter Rule Wizard 的第一页上,选择 Content Type 选项并单击 Next>。
  5. 最后,在 Content Type 下拉菜单中,选择“Ant Buildfile”。
  6. 单击 Finish 和几个 OK,这应该处理现有和未来的 Ant Build 文件验证警告。

回答by BruceR

Even though this thread is a little older, somebody might find this interesting:

即使这个线程有点老,有人可能会觉得这很有趣:

http://www.cs.hs-rm.de/~knauf/KomponentenArchitekturen2008/jsfunit/index.html

http://www.cs.hs-rm.de/~knauf/KomponentenArchitekturen2008/jsfunit/index.html

Go to Project Properties-> Validationand follow the screen shots on that page. Should be easy even if you don't speak German. ;-)

转到Project Properties-> Validation并按照该页面上的屏幕截图进行操作。即使您不会说德语,也应该很容易。;-)

This solution worked perfectly for me. Cheers!

这个解决方案对我来说非常有效。干杯!

回答by damoco

You can delete it, and restore it to avoid the warning. It is a bug, obviously.

您可以删除它,然后恢复它以避免出现警告。很明显,这是一个错误。

回答by jcalfee314

I see an option to disable this in newer versions of Eclipse. It is under: Window, Preferences, XML, XML Files, Validation then change the drop-down "Indicate when no grammar is specified:" from "Warn" to "Ignore"..

我在较新版本的 Eclipse 中看到了禁用此功能的选项。它位于:窗口、首选项、XML、XML 文件、验证然后将下拉菜单“指示未指定语法时:”从“警告”更改为“忽略”。

回答by Matthew Farwell

In fact, as damoco says, this seems to be a bug in Eclipse. If I delete (copy elsewhere) the file from windows, refresh eclipse, and then restore the file, and refresh again, the warning goes away.

事实上,正如 damoco 所说,这似乎是 Eclipse 中的一个错误。如果我从 Windows 中删除(复制到其他地方)文件,刷新 eclipse,然后恢复文件,然后再次刷新,警告就会消失。

I'm using Eclipse Galileo build 20090621-0832.

我正在使用 Eclipse Galileo 版本 20090621-0832。

回答by Dustin Getz

right click on the warning to delete it, then clean

右键单击警告将其删除,然后清除