Last Updated: February 25, 2016
·
2.144K
· hendrikwill

Eclipse Java EE jQuery Validation Error Workaround

During my recent Java EE project I came across an annoying bug which always showed an Error Symbol on my root project folder. At first I thought it was a Java error but then I saw it was caused by the minified version of jQuery. This is an Eclipse bug already reported in summer 2011. I guess this can also happen with other minified JavaScript files.

Workaround – How to fix

To get rid of the annoying Error symbol do the following:

  1. Right click your Project root folder in your Eclipse Project Explorer View
  2. Go to Properties -> JavaScript -> Include Path -> Source Tab
  3. Select Excluded and Edit… and then Add..
  4. Now you can either browse for JavaScript file which has errors or just enter a wildcard pattern which will exclude anything matched by your pattern. In my case in entered **/jquery*.js to exclude all jQuery library files.
  5. Then you can hit OK, Finish and OK again
  6. Your Eclipse Progress View should now show a Building Workspace message
  7. Tada! The Error Symbol is gone!

Background information

So what did Eclipse do for us?

It added a file named .jsdtscope to the .settings folder. This might be faster for console lovers among us.

Content of the .jsdtscope file:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/jquery*.js" kind="src" path=""/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path=""/>
</classpath>