好的。我厌倦了这个问题。这个必须有一个简单的解决办法,我确信这一点!!我希望SO能帮助我一劳永逸地摆脱这个问题!
Question
How do we get Eclipse to stop trying to process/compile all files under a particular project directory? The goal is for no errors/warnings to exist in the problems view if they relate to something in this folder or it's subfolders.
背景
我们运行 Eclipse 3.6,m2eclipse 插件 v0.10.2.20100623 管理我们的自动构建。由于我无法控制的原因,我们在 SVN 项目目录中的 src/main/resources/blazeds 下拥有整个 BlazeDS 发行版。本质上,该目录包含运行 blazeds 的 tomcat 的普通发行版,当我们通过 SCP 部署到服务器时,所有配置和项目文件都会添加到其中。
所以,当我们运行deploy时,这个版本的tomcat被复制到服务器上,我们的项目也被放置在里面。 Tomcat 和我们的 RIA 应用程序工作正常,一切都很好。
问题是,运行 AutoBuild 时,Eclipse 会尝试编译 src/main/resources/blazeds 下的所有内容,这会在我们的问题 View 中生成大约 300 个错误/警告。因此,当真正的错误出现时,它就会被淹没在噪音中。
错误源于 /blazeds/tomcat/webapps/samples/testdrive-datapush
以及 testdrive-httpservice
、traderdesktop
中的代码示例网络应用程序。它们具有不在类路径上的依赖源代码和不包含在库中的 jar。
尝试失败的解决方案
我正在尝试推出正确的解决方案:完全删除样本,并从我们的版本控制中删除。这种情况不会很快发生。
我已关注SO answer here但这只是一个非常临时的解决方案。我尝试在所有我能想到的地方添加排除项,我的团队的其他成员也做了同样的事情。我已删除 src/main/resources 作为源目录(在首选项 > Java 构建路径 > 源选项卡中),我已在资源目录下添加了 blazeds 的排除项。我已经尝试了 blazeds
和 **
的每种排列,如 *blazeds*
、**/blazeds/**
等
我什至尝试过包含编译器提示的库和源文件,但如果不过度破坏我们的项目配置,我就无法做到正确。
<小时/> 更新#2:Summary
This has to be simple. What is the conventional way to exclude a folder that is producing warnings/errors in an eclipse project?
Update #1:
gedim's solution below is decent but it
1) doesn't clear red X's from the project
2) is a change everyone on our team needs to do, manually
(i.e., it's not in a project property file; thereby, it isn't checked into subversion)
I hope there's a way to address the core problem by telling Eclipse that this directory doesn't contain
items to compile/validate. Such a change would likely show up in one of the project setting files.
下图显示了我正在尝试清除的红色 X
构建路径 > 排除
不是一个选项...
最佳答案
我遇到了类似的问题,并通过将该文件夹移动到我的项目文件夹中来解决它。然后我去了:
- 项目 > 属性 > 资源 > 资源过滤器 > 添加...
- 设置过滤器类型 = 全部排除。
- 设置应用于 = 文件夹。
- 设置文件和文件夹属性 = { 名称, matches, < your_folder_name > }
关于eclipse - 如何排除 Eclipse 项目中产生警告/错误的文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3736208/