How to exclude specific folders or files from validation in Eclipse?

Eclipse

Eclipse Problem Overview


We have a bunch of malformed XML files used in unit tests to check if our application can handle them.

Eclipse marks this XML files with errors, polluting the "problem view".

Is there a way to exclude a specific folder from Eclipse validators?

Eclipse Solutions


Solution 1 - Eclipse

In the Validation section of Window > Preferences you can add different rules in settings (...) column, you can add a "Folder or file name rule" in the Exclude Group for XML types.

Solution 2 - Eclipse

This is what I do to exclude a folder from validation in a project. For me this works for javascript and other warnings/errors.

  • Right Click Folder
  • Click Resource, ResourceFilters
  • Click "Add"
  • Set the following Exclude All, Files and Folders, All Children, add an asterisk (*) to the File and Folder Attributes input field (highlighted in the image below)

Note: In Eclipse Indigo you have to Right click the folder and select properties and then select resource in the left navigation.

enter image description here

Solution 3 - Eclipse

With Eclipse 2018-12 in an Angular-Project, i was able to get rid of validation errors in the folders, npm generates (like node_modules), just by selecting a folder and check the "Derived" check mark under "Resource".

eclipse - ignore validation on folders by check the

After a Project -> Clean the Errors are gone.

Solution 4 - Eclipse

  1. Go to Window > Preference > Validation
  2. Find the type of validation you want to disable, for instance XML.
  3. Right-click it and select "Settings":

Eclipse validation

  1. In the "Exclude Group", click "Add rule", select "Folder or file name":

enter image description here

Solution 5 - Eclipse

Note: I got here because I was searching for an easy way to exclude specific folders from validation in Eclipse. My answer does not work for the specific case detailed in the question (which is about hiding invalid XML files from validation).

How to exclude specific folders or files from validation in Eclipse?

When the folders is in the build path, and when the annoying issues are only warnings, there is a way that is straight forward:

  • Right Click Folder
  • Properties
  • Java Compiler
  • Check Ignore optional compile problems
  • Ok

The folders will still be validated, errors will be reported, but all the warnings will be ignored by Eclipse. For example, that's ideal for a folder of generated sources.

Solution 6 - Eclipse

you may also adjust the output/view side. So go to Show-Menu of Problem-View and filter Display only for selected Items. enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSerxipcView Question on Stackoverflow
Solution 1 - Eclipseuser159088View Answer on Stackoverflow
Solution 2 - EclipseShanimalView Answer on Stackoverflow
Solution 3 - EclipsehinneLinksView Answer on Stackoverflow
Solution 4 - EclipseNicolas RaoulView Answer on Stackoverflow
Solution 5 - EclipseboumbhView Answer on Stackoverflow
Solution 6 - EclipseSLNView Answer on Stackoverflow