简体   繁体   English

.ant-targets-build.xml 使 eclipse 项目出错

[英].ant-targets-build.xml puts eclipse project into error

I am using the most excellent ant/bin/complete-ant-cmd.pl for bash completion of ant targets and it caches its results in a file called.ant-targets-build.xml.我正在使用最优秀的 ant/bin/complete-ant-cmd.pl 来完成 ant 目标的 bash,并将其结果缓存在名为.ant-targets-build.Z0F635D0E0F38274FFF8B581C1 的文件中。 The problem is, in my eclipse project, eclipse is a little overaggressive validating everything it believes is actually XML (which.ant-targets-build.xml isn't...its just the raw targets separated by newlines). The problem is, in my eclipse project, eclipse is a little overaggressive validating everything it believes is actually XML (which.ant-targets-build.xml isn't...its just the raw targets separated by newlines).

How do I get eclipse to relax its restrictions and treat.ant-targets-build.xml as NOT an xml file...just text or something.如何让 eclipse 放宽其限制并将.ant-targets-build.xml 视为不是 xml 文件...只是文本或其他内容。

Project->Properties项目->属性

  • Check Enable project specific settings .选中Enable project specific settings
  • Click ellipsis next to XML Validator单击XML Validator旁边的省略号

项目属性

  • Click on Exclude Group点击Exclude Group
  • Click on Add Rule点击Add Rule

验证规则

Follow wizard and create File exclusion.按照向导并创建File排除。

One of the most annoying "features" of this dialog is that you cannot edit existing rules.此对话框最烦人的“功能”之一是您无法编辑现有规则。 If you make a mistake you will need to delete that rule and recreate it from scratch.如果您犯了错误,您将需要删除该规则并从头开始重新创建它。

BTW, in your case it may be preferable to create a global workspace rule ( I usually like to keep special cases with the project ).顺便说一句,在您的情况下,最好创建一个全局工作区规则(我通常喜欢在项目中保留特殊情况)。

In any case after you finished with rule creation, right-click on a project with warnings and choose Validate .无论如何,在您完成规则创建后,右键单击带有警告的项目并选择Validate This will clear these warnings这将清除这些警告

If you decided to edit validation preferences in project and not in workspace, then add project-name/.setting/org.eclipse.wst.validation.prefs file to source control.如果您决定在项目中而不是在工作区中编辑验证首选项,则将project-name/.setting/org.eclipse.wst.validation.prefs文件添加到源代码管理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM