资源不在 javascript 项目的构建路径上

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24505993/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 12:39:26  来源:igfitidea点击:

The resource is not on the build path of a javascript project

javajavascripteclipsemaven

提问by Shivendra

I am making a javaEE project. I imported a project from my computer as a maven project (Import->Import as maven project) The project has many javascript files in the source folder. Eclipse is not showing outline of my javascript files. '

我正在制作一个javaEE项目。我从我的电脑导入了一个项目作为maven项目(Import->Import as maven project)该项目在源文件夹中有很多javascript文件。Eclipse 没有显示我的 javascript 文件的大纲。'

However when i imported the project as a javascript project the outline was shown correctly!!

但是,当我将项目作为 javascript 项目导入时,大纲显示正确!

How can i make the outline correct when i import it as a maven project?

当我将其作为 maven 项目导入时,如何使大纲正确?

采纳答案by E-Riz

I just answered this for another question, very similar to yours.

我刚刚回答了另一个问题,与您的问题非常相似。

You need to add the JavaScript "nature" to the project (basically, tell Eclipse to treat it as a JavaScript project). Right-click on the project and choose Configure > Convert to JavaScript Project....

您需要将 JavaScript“性质”添加到项目中(基本上,告诉 Eclipse 将其视为 JavaScript 项目)。右键单击项目并选择配置 > 转换为 JavaScript 项目...。

enter image description here

在此处输入图片说明

After doing that you should see a Builder named "JavaScript Validator" and have the JavaScript section in the properties.

这样做之后,您应该会看到一个名为“JavaScript Validator”的构建器,并在属性中包含 JavaScript 部分。

回答by dimoniy

Check that you have .jsfiles associated to Javascript Editor. Go to Window->Preferences-General -> Editors -> File Associations. Find the "*.js"entry, click on it, then click on Javascript Editorand click the Default button.

检查您是否有.js与 Javascript 编辑器关联的文件。转到窗口-> 首选项-常规-> 编辑器-> 文件关联。找到"*.js"条目,单击它,然后单击Javascript Editor并单击默认按钮。

回答by jsanmarb

This work for me in Eclipse Photon:

这在 Eclipse Photon 中对我有用:

  1. Close Eclipse.
  2. Edit the .project file adding the Javascript nature: org.eclipse.wst.jsdt.core.jsNature
  1. 关闭日食。
  2. 编辑 .project 文件,添加 Javascript 性质:org.eclipse.wst.jsdt.core.jsNature

enter image description here

在此处输入图片说明

Source

来源