Change Eclipse settings to ignore errors on a specific file

oym picture oym · Nov 26, 2010 · Viewed 83.4k times · Source

In my dynamic web project in eclipse, I have jQuery in my js source folder. For some reason, Eclipse is not handling it correctly and interpreting many lines as errors in the standard jQuery file (even though I have the javascript development tools installed).

Can I turn off the error checking on the jQuery file (and that file only)? I still want it to detect errors as usual, but ignore anything in jQuery.js.

Answer

Gábor Lipták picture Gábor Lipták · Nov 26, 2010

It looks like eclipse has changed a bit,
but the following method which worked for me seems very close to the old one.

The solution consists of 2 steps:

  1. First you have to update Eclipse's preferences (Window > Preferences):

    Update eclipse's preferences

    Make sure that you check both Manual & Build next to the Validator you need
    (in my case - a javascript one).

  2. Last you should change your project's Validators:

    Update project's validators

    Click on Client-side JavaScript Settings (or any other validator you need):

    Validator settings

    The explanation is clear but basically what you should do is as follows:

    Click on Add Exclude Group..., select it and then click on Add rule....
    Then pick Folder or file name (note that there are other options), and specify your file/folder.

You should be able to verify that its working by deleting the existing errors/warnings,
and then left-click your project and select the Validate option.

This setting can be committed into source control as well.