如何排除在 Eclipse 项目中产生警告/错误的文件夹? [英] How to exclude a folder that is producing warnings/errors in an Eclipse project?

查看:31
本文介绍了如何排除在 Eclipse 项目中产生警告/错误的文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的.我厌倦了这个问题.这必须有一个简单的修复,我敢肯定!!我希望 SO 可以帮助我一劳永逸地摆脱这个!

Okay. I'm sick of this problem. This has to have an easy fix, I'm sure of it!! I hope SO can help me to get rid of this once and for all!

问题

我们如何让 Eclipse 停止尝试处理/编译a下的所有文件特定的项目目录?这目标是没有错误/警告存在于问题视图中,如果它们与此文件夹或其子文件夹中的内容相关.

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 管理我们的自动构建.由于我无法控制的原因,我们在 src/main/resources/blazeds 下的 SVN 项目目录中有整个 BlazeDS 发行版.本质上,这个目录包含运行 blazeds 的 tomcat 的 vanilla 发行版,当我们通过 SCP 部署到我们的服务器时,我们所有的配置和项目文件都会添加到其中.

We run Eclipse 3.6 and the m2eclipse plugin v0.10.2.20100623 manages our autobuild. For reasons beyond my control, we have the entire BlazeDS distribution in our SVN project directory under src/main/resources/blazeds. Essentially, this directory contains a vanilla distribution of tomcat running blazeds to which all our configuration and project files are added when we deploy to our server via SCP.

所以,我们运行deploy的时候,就是把这个版本的tomcat拷贝到服务器上,我们的项目就放在里面了.Tomcat 和我们的 RIA 应用程序工作正常,一切正常.

So, when we run deploy, this version of tomcat is copied to the server and our project is placed inside. Tomcat and our RIA application work and everything is fine.

问题是,Eclipse 会在运行 AutoBuild 时尝试编译 src/main/resources/blazeds 下的所有内容,这会在我们的问题视图中生成大约 300 个错误/警告.因此,当真正的错误浮出水面时,它就会消失在噪声中.

The problem is, Eclipse tries to compile everything under src/main/resources/blazeds when running AutoBuild and this generates about 300 errors/warnings in our problem view. So when a real error surfaces, it gets lost among the noise.

错误源于 /blazeds/tomcat/webapps/samples/testdrive-datapush 以及 testdrive-httpservicetraderdesktop 中的代码示例网络应用程序.它们具有不在类路径中的相关源代码和未包含在库中的 jar.

The errors stem from code in /blazeds/tomcat/webapps/samples/testdrive-datapush and also the testdrive-httpservice, traderdesktop example webapps. They have dependent source code that's not on the classpath and jars that aren't included in the libraries.

尝试解决方案失败

我正在尝试推出正确的解决方案:完全删除样本,并从我们的版本控制中移除 blazeds.这不会很快发生.

I'm trying to push the proper solution: to remove the samples completely and also to get blazeds out of our version control. That's not happening anytime soon.

我遵循了 SO 在这里回答 但这只是一个非常临时的解决方案.我试过在我能想到的任何地方添加排除项,我团队的其他成员也这样做了.我已经删除了 src/main/resources 作为源目录(在首选项 > Java 构建路径 > 源选项卡中)我在资源目录下为 blazeds 添加了排除项.我已经尝试了 blazeds** 的所有排列,如 *blazeds***/blazeds/**

I've followed the SO answer here but it's only a very temporary solution. I've tried adding exclusions everywhere I can think of and other members of my team have done the same. I've removed src/main/resources as a source directory (in preferences > Java Build Path > Source Tab) I've added exclusions for blazeds under the resource directory. I've tried every permutation of blazeds and ** as in *blazeds*, **/blazeds/**, etc.

我什至尝试包含编译器抱怨的库和源文件,但如果不过度修改我们的项目配置,我就无法做到.

I've even tried including the libraries and source files the compiler is complaining about but I couldn't get it right without excessively mangling our project configuration.

总结

这必须很简单.是什么排除文件夹的常规方法产生警告/错误Eclipse 项目?

This has to be simple. What is the conventional way to exclude a folder that is producing warnings/errors in an eclipse project?

<小时>更新 #1:
下面gedim的解决方案不错,但它
1) 不清除项目中的红色 X
2) 是我们团队中的每个人都需要手动进行的更改
(即,它不在项目属性文件中;因此,它不会被签入 subversion)

我希望有一种方法可以通过告诉 Eclipse 这个目录不包含来解决核心问题
要编译/验证的项目.此类更改可能会显示在其中一个项目设置文件中.


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.

<小时>更新 #2:

下图显示了我正在尝试清除的红色 X
构建路径>排除
不是一个选项...

The picture below shows the red X's I'm trying to clear and that
Build Path > Exclude
isn't an option...

推荐答案

您可以使用问题面板菜单上的Configure Contents....您可以在那里创建新配置并将范围设置为 On Working Set:.单击 Select... 并创建一个新的工作集,排除您不想要的文件夹.

You can use the Configure Contents... on the menu of Problems panel. There you can create a new configuration and set the scope to On Working Set:. Click on Select... and create a new working set that excludes the folders you don't want.

这篇关于如何排除在 Eclipse 项目中产生警告/错误的文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆