About adding the jquery-1.x.js file to the Eclipse project to report an error

Now when using Eclipse 3.7 and later versions, adding a jQuery file will report an error, and a small red X will be displayed on it. Although this will not affect the operation of the project, it will affect the developer's mood. See this Always very uncomfortable, how to solve it. It's very simple. First, let's analyze the reasons for this situation. If you are a careful person, go to study the .project file in the project, and you will find such a piece of code, as shown in the figure:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>appMarket</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<!--<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>-->
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<!--<nature>org.eclipse.wst.jsdt.core.jsNature</nature>-->
</natures>
</projectDescription>

 

 <buildSpec>节点下的这些代码,你会发现第一个有个 org.eclipse.wst.jsdt.core.javascriptValidator,问题就在这里,这个就是javascript验证,而jQuery里面有些javascript代码写法并不规范,所以这里就会验证出错,看到这里大家都应该明白怎么做了吧,很简单,把这段代码删掉,或者注释掉

注意了是这段代码

 <buildCommand>
   <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
   <arguments>
   </arguments>
  </buildCommand>

和下面这段

<nature>org.eclipse.wst.jsdt.core.jsNature</nature>

你只需要注释这两段代码就可以,千万别注释多了,也别少注释了

好了 这下把你项目中那个错的jquery删除,然后从新复制一个jquery文件粘贴进去,再看看 这会不抱错了吧,问题解决,

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326984065&siteId=291194637