How to exclude a Javascript file from Javascript Validation in Eclipse How to exclude a Javascript file from Javascript Validation in Eclipse javascript javascript

How to exclude a Javascript file from Javascript Validation in Eclipse


well, probably I've managed to do what you need ;) It is a bit tricky. So my steps:

  1. downloaded Eclipse PDT (to be surethat it works for you, because I useEclipse for Java EE)
  2. created project TestJS (it wasJavaScript project)
  3. created two files, test.js andhtmlparser.js (last one copied fromJohn Resig's site)
  4. typed "broken" script in both of them, so Eclipse told me that there were errors in both of them
  5. went to Project Properties >JavaScript > Include Path > Source,there is "Excluded" to highlight andpress "Edit" button, here you areable to add what you want to exclude(file, folder, pattern).
  6. I excluded "test.js" file, pressedapply...
  7. ...and got a happy ending: nowEclipse point me out that there iserror in htmlparser.js, but not intest.js ;)

ScreenShot:enter image description here

Really hope that it helps!


Following from Maxym's excellent answer: since I usually keep all my JavaScript libraries in one place and the Eclipse validator tends to find unusual errors (perhaps entirely false positives), I used the Add Multiple option and selected the folders that contained those libraries. No need to update each time you add a file!

enter image description here