简体   繁体   English

同时兼顾Java和JavaScript

[英]Java and JavaScript nature simultaneously

I have a larger maven multi-module project where multiple languages are involved. 我有一个更大的maven多模块项目,涉及多种语言。 Now with Eclipse JDT and JSDT installed the code coloring works fine but code completion in JavaScript does not work very well which makes it hard to be productive. 现在安装了Eclipse JDT和JSDT,代码着色工作正常但JavaScript中的代码完成效果不佳,这使得很难提高工作效率。 Eclipse does not seem to find JavaScript classes in my project so i am also not able to jump around JavaScript methods very easily. Eclipse似乎没有在我的项目中找到JavaScript类,所以我也无法轻松地跳转JavaScript方法。 Mapping JavaScript classes seems also not possible since this is a Java project and i see no way to mix up project natures. 似乎也不可能映射JavaScript类,因为这是一个Java项目,我认为没有办法混淆项目性质。

Is there a way to improve this behavior? 有没有办法改善这种行为? Or are there any other JavaScript Plugins which are able to do so and work simultaneously with JDT? 或者是否有其他JavaScript插件可以这样做并与JDT同时工作?

You can definitely mix Java and JavaScript development in Eclipse. 你绝对可以在Eclipse中混合Java和JavaScript开发。 The Dynamic Web Project creates such a configuration by default. 默认情况下,Dynamic Web Project会创建此类配置。

To add JavaScript support to any Java project, do the following... 要向任何Java项目添加JavaScript支持,请执行以下操作...

  1. Project Properties -> Project Facets 项目属性 - >项目方面
  2. Click on "Convert to faceted form" link 单击“转换为分面形式”链接
  3. Check JavaScript and hit ok to close the dialog. 检查JavaScript并点击“确定”关闭对话框。
  4. Make sure that you are in a perspective that has "Project Explorer" view as opposed to "Package Explorer", which is standard in Java perspective or open that view yourself. 确保您处于具有“Project Explorer”视图而不是“Package Explorer”的透视图中,这是Java透视图中的标准视图或者您自己打开该视图。 Unlike the Java-specific Package Explorer, the Project Explorer view accommodates different technology extensions, such as JavaScript. 与特定于Java的Package Explorer不同,Project Explorer视图适用于不同的技术扩展,例如JavaScript。

Enjoy. 请享用。 Facets are somewhat like natures, but unlike natures the can be user-manipulated without hacking metadata files. Facets有点像自然,但与自然不同,可以在不破坏元数据文件的情况下进行用户操作。 New Eclipse tooling, like JSDT has been moving to providing facets to make enablement easier. 新的Eclipse工具,如JSDT,已经开始提供方面,使启用更容易。

Does it work for you if you open up your .project file and add a new <nature> into the <natures> element? 如果打开.project文件并在<natures>元素中添加新的<nature>它是否适合您? I've done that to apply the java nature to non-java projects which had other natures. 我已经这样做,将java性质应用于具有其他性质的非java项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM