更改Eclipse设置,以忽略特定文件上的错误。

时间:2022-04-15 22:27:47

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).

在eclipse中的动态web项目中,js源文件夹中有jQuery。由于某些原因,Eclipse没有正确地处理它,并将许多行解释为标准jQuery文件中的错误(尽管我已经安装了javascript开发工具)。

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.

我可以关闭jQuery文件上的错误检查吗?我仍然希望它像往常一样检测错误,但忽略jQuery.js中的任何内容。

7 个解决方案

#1


91  

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

看起来eclipse已经发生了一些变化,但是下面对我有用的方法似乎与旧方法非常接近。

The solution consists of 2 steps:

解决方案包括两个步骤:

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

    首先,您必须更新Eclipse的首选项(窗口>首选项):

    更改Eclipse设置,以忽略特定文件上的错误。

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

    请确保在您需要的验证器(在我的例子中是一个javascript验证器)旁边同时检查Manual和Build。

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

    最后,您应该更改项目的验证器:

    更改Eclipse设置,以忽略特定文件上的错误。

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

    单击客户端JavaScript设置(或您需要的任何其他验证器):

    更改Eclipse设置,以忽略特定文件上的错误。

    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.

您应该能够通过删除现有的错误/警告来验证它的有效性,然后单击项目并选择Validate选项。

This setting can be committed into source control as well.

这个设置也可以提交到源代码控制中。

#2


1  

I had javascript errors seen on jquery mobile file on an Android Phonegap project. I simply removed the file from the project and add it afterwards. It works now.

我在Android Phonegap项目的jquery移动文件上看到了javascript错误。我只是从项目中删除了这个文件,然后添加它。现在工作。

#3


0  

Perform these steps to solve this(This will disable eclipse validation for Javascript): 1. Go to Eclipse > preference > Javascript> validators > Errors/Warnings 2. Uncheck "Enable JavaScript semantic validation".

执行以下步骤来解决这个问题(这将禁用Javascript的eclipse验证):1。转到Eclipse >首选项> Javascript>验证器>错误/警告2。取消“启用JavaScript语义验证”。

If you have messed around with the javascript settings in your projects, then restore everything to default first for all the projects that u have changed. After that, follow the steps.

如果您在项目中使用了javascript设置,那么首先要将您更改的所有项目恢复为默认值。然后,按照步骤进行。

#4


0  

One way is that : 1.remove javascript -> validator -> errors/warning. 2.remove project -> .project file -> javascript command 3.It is important,too! delete js file and import again.

一种方法是:1。删除javascript ->验证器->错误/警告。2。删除project -> .project file -> javascript命令3。是很重要的!删除js文件并再次导入。

#5


0  

I just had this problem, even though I suspended all the validators. I applied Gabor's solution above, applied the change, re-excluded the validators, and voila: it worked. Thanks!

我刚刚遇到了这个问题,尽管我暂停了所有的验证器。我在上面应用了Gabor的解决方案,应用了变更,重新排除了验证器,结果是:它成功了。谢谢!

#6


0  

With eclipse Luna I was getting this as well. I did a right click on jquery.jqGrid.min.js and selected 'Validate'. It then validated fine and the errors went away.

有了月蚀,我也得到了这个。我在jquery.jqGrid.min上右键单击。js和选择“验证”。然后它验证了fine,错误消失了。

#7


0  

Not sure if it'll work for all. But what i did was select the unnecessary errors in 'problems' tab of eclipse, Rclick and Delete. Eclipse stopped showing the error..

不确定它是否适用于所有人。但是我所做的是在eclipse的“problems”选项卡中选择不必要的错误,Rclick和Delete。Eclipse停止显示错误。

#1


91  

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

看起来eclipse已经发生了一些变化,但是下面对我有用的方法似乎与旧方法非常接近。

The solution consists of 2 steps:

解决方案包括两个步骤:

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

    首先,您必须更新Eclipse的首选项(窗口>首选项):

    更改Eclipse设置,以忽略特定文件上的错误。

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

    请确保在您需要的验证器(在我的例子中是一个javascript验证器)旁边同时检查Manual和Build。

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

    最后,您应该更改项目的验证器:

    更改Eclipse设置,以忽略特定文件上的错误。

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

    单击客户端JavaScript设置(或您需要的任何其他验证器):

    更改Eclipse设置,以忽略特定文件上的错误。

    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.

您应该能够通过删除现有的错误/警告来验证它的有效性,然后单击项目并选择Validate选项。

This setting can be committed into source control as well.

这个设置也可以提交到源代码控制中。

#2


1  

I had javascript errors seen on jquery mobile file on an Android Phonegap project. I simply removed the file from the project and add it afterwards. It works now.

我在Android Phonegap项目的jquery移动文件上看到了javascript错误。我只是从项目中删除了这个文件,然后添加它。现在工作。

#3


0  

Perform these steps to solve this(This will disable eclipse validation for Javascript): 1. Go to Eclipse > preference > Javascript> validators > Errors/Warnings 2. Uncheck "Enable JavaScript semantic validation".

执行以下步骤来解决这个问题(这将禁用Javascript的eclipse验证):1。转到Eclipse >首选项> Javascript>验证器>错误/警告2。取消“启用JavaScript语义验证”。

If you have messed around with the javascript settings in your projects, then restore everything to default first for all the projects that u have changed. After that, follow the steps.

如果您在项目中使用了javascript设置,那么首先要将您更改的所有项目恢复为默认值。然后,按照步骤进行。

#4


0  

One way is that : 1.remove javascript -> validator -> errors/warning. 2.remove project -> .project file -> javascript command 3.It is important,too! delete js file and import again.

一种方法是:1。删除javascript ->验证器->错误/警告。2。删除project -> .project file -> javascript命令3。是很重要的!删除js文件并再次导入。

#5


0  

I just had this problem, even though I suspended all the validators. I applied Gabor's solution above, applied the change, re-excluded the validators, and voila: it worked. Thanks!

我刚刚遇到了这个问题,尽管我暂停了所有的验证器。我在上面应用了Gabor的解决方案,应用了变更,重新排除了验证器,结果是:它成功了。谢谢!

#6


0  

With eclipse Luna I was getting this as well. I did a right click on jquery.jqGrid.min.js and selected 'Validate'. It then validated fine and the errors went away.

有了月蚀,我也得到了这个。我在jquery.jqGrid.min上右键单击。js和选择“验证”。然后它验证了fine,错误消失了。

#7


0  

Not sure if it'll work for all. But what i did was select the unnecessary errors in 'problems' tab of eclipse, Rclick and Delete. Eclipse stopped showing the error..

不确定它是否适用于所有人。但是我所做的是在eclipse的“problems”选项卡中选择不必要的错误,Rclick和Delete。Eclipse停止显示错误。