Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
504 views
in Technique[技术] by (71.8m points)

ide - How to exclude a folder that is producing warnings/errors in an Eclipse project?

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!

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.

Background

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.

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.

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.

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.

Failed Attempted Solutions

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.

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.

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.


Update #2:

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

Red X's won't go away

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I encountered a similar problem and resolved it by moving the folder into my project folder. I then went to:

  1. Project > Properties > Resource > Resource Filters > Add...
  2. Set Filter type = Exclude all.
  3. Set Applies to = Folders.
  4. Set File and Folder Attributes = { Name, matches, < your_folder_name > }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...