How to exclude a folder that generates warnings / errors in an Eclipse project?

Good. I'm sick of this problem. It should be easy to fix, I'm sure of it! I hope SO helps me get rid of this once and for all!

Question

How to make Eclipse stop trying to process / compile all files under a specific project directory? the goal is that no errors / warnings exist in presenting problems if they relate to something in this folder or to subfolders.

Background

We are running Eclipse 3.6, and the m2eclipse v0.10.2.20100623 plugin controls our auto-object. For reasons beyond my control, we have the entire BlazeDS distribution in our SVN project directory under src/main/resources/blazeds . In fact, this directory contains the tomcat vanilla distribution that launches blazeds, to which all our configuration and project files are added when deployed to our server via SCP.

So, when we start the deployment, this version of tomcat is copied to the server, and our project is placed inside. Tomcat and our RIA application work, and everything is in order.

The problem is that Eclipse is trying to compile everything under src/main/resources/blazeds when AutoBuild starts, and this generates about 300 errors / warnings in our view of the problem. Therefore, when a real error occurs, it is lost in the midst of noise.

Errors are related to the code in /blazeds/tomcat/webapps/samples/testdrive-datapush , as well as traderdesktop testdrive-httpservice , traderdesktop web application traderdesktop . They have dependent source code that does not apply to classes and banks that are not included in libraries.

Unsuccessful attempts to solve

I am trying to push the correct solution: completely remove the samples, as well as get rid of version control. This is not happening anytime soon.

I followed the Answer here here , but this is only a very temporary solution. I tried adding exceptions everywhere I can think of, and the other members of my team did the same. I removed src/main/resources as the source directory (in Settings> Java Build Path> Source Tab). I have added exceptions for blazeds to the resource directory. I tried every permutation blazeds and ** as in *blazeds* , **/blazeds/** etc.

I even tried, including the libraries and source files that the compiler complains about, but I could not figure it out without overly changing the project configuration.

Summary

It should be easy. What is the usual way to exclude a folder that creates warnings / errors in an eclipse project?




Update # 1:
The gedim solution below is decent, but it 1) does not clear red X from the project
2) - this is a change that all members of our team must perform manually (i.e. not in the project properties file, thereby it is not checked for subversion)

I hope there is a way to solve the main problem by telling Eclipse that this directory does not contain compilation / validation items. Such a change is likely to appear in one of the project settings files.




Update # 2:

The figure below shows the red X that I am trying to clear, and that Build Path > Exclude
not an option...

Red X's won't go away

+49
eclipse build-process ide m2eclipse
Sep 17 '10 at 14:28
source share
8 answers

You can use Configure Contents... in the menu of the Problems panel. There you can create a new configuration and set the On Working Set: . Press Select... and create a new working set that excludes folders that you do not need.

+27
Sep 17 '10 at 14:36
source share

I ran into a similar problem and resolved it by moving the folder to the project folder. Then I went:

  • Project> Properties> Resources> Resource Filters> Add ...
  • Set Filter Type = Exclude All .
  • Set Applies to = Folders .
  • Set File and Folder Attributes = {Name, matches, <your_folder_name>}
+52
Dec 15 '12 at 19:13
source share

There is a request to the Eclipse function to ignore warnings from the specified source folders. Several corrections have been included in the comment stream that provide the implementation of the function. It seems that the final patch is approaching the review phase for inclusion in the upcoming release.

Update 6/19/2012 . Eclipse Juno 4.2M6 supports ignoring issues for a specific source folder. This feature is available in the Java Path dialog box. See release note .

+5
Oct 28 '11 at 14:24
source share

If you really want to exclude certain classes / packages from autobuild, you can simply right-click them and select "Build Path" β†’ "Exclude"

alt text

+2
Sep 20 '10 at 13:50
source share

Set up your project (Project / Properties / Java Build Path / Source) instead of the top-level src folder with exceptions, just a list of folders that you want to compile.

Assuming Eclipse Helios, step by step:

  • Disable auto-merge (Project / Build Automatically).
  • Start with it empty.
  • Remove errors by right-clicking on the link (just to be sure).
  • Add original folders with 1 in 1 folders (Project / Properties / Java Build Path / Source / Add Folder)
  • Make an explicit build (Project / Build Project).

If this works, you can re-enable autobond. If this is not the case, something strange happens. Perhaps the project does not use standard Java Builder, but something like Ant Builder (Project / Properties / Builders).

0
Sep 23 '10 at 23:14
source share

Go to Java build path β†’ Source β†’ Add Folder

Choose the correct folders that should be part of the build path

In the above screenshot, src / main / resources needs to be removed from the assembly, as this leads to a compilation error [invalid package identifier]. Therefore, include the folder before src / main / resources.

I tried to create a path -> Exclude. This does not actually solve the problem. although the RedX token is cleared of Eclipse, it will no longer be Java project rights. Perhaps the user will not be able to run the JUnit Test case / debug, etc.

But by including the right folders, we can continue to work with the Java Project.

0
Aug 12 '16 at 9:44
source share

Since the files in the resource folder rarely change, I suggest placing them in a second project (where you can set various warning parameters), and then access this via a relative path (for example, ${basedir}/../special-tomcat ) .

-one
Sep 22 '10 at 9:24 a.m.
source share

The best approach is to use the Include and Exclude Patterns option in the Java build path.
For example, if you want to exclude one project for automatic assembly:
1- Go to Properties β†’ Java Build Path β†’ Source.
2- Expand the folder in the folder "Source folders on the build path:"
3- Select "Exclude" β†’ "Edit"
4- In the exception patterns add **
Note: for more information about these patterns: Inclusion and exclusion patterns

-one
Aug 22 '13 at 16:00
source share



All Articles