日食和刻面
在java课程中,每个人(或者至少是大多数人)似乎都有一个工作日食。他们似乎总是有一个工作面孔配置(视觉配置),并且在 xhtml 文件中自动完成(对于 Facelets)。不过为了自动完成,我们在 JSP 上添加了 *.xhtml 文件。
看来这是我对 eclipse 不太了解的部分,而且由于我不知道为什么,这很烦人。当我导入一个项目(无论是 Maven 还是现有的)时,它总是没有 Facets,只有 java(在 1.5 中甚至没有 1.6),而它应该是一个 Web 项目并且有 Facets 和 Facets。动态网络项目。
我可以改变这些方面吗?当我将 java 设置为 1.6 时,它似乎可以工作,但尝试将动态 Web 模块版本从 2.4 编辑到 2.5(这是 2.4 的标准),而没有遇到一些麻烦。即使我刚刚创建了一个新的 Maven 项目(在命令行中使用了 archtype),我也无法对这些方面进行太多更改。
我做错了什么?
In the courses java, everyone (or at least most people) seemed to have a working eclipse. They always seemed to have a working faces-config (a visual one), and autocomplete in xhtml files (for facelets). Though for autocomplete, we added *.xhtml files on JSP's.
It seems that this was a part I don't know well about eclipse, and it's fairly annoying since I don't know why. When I import a project (either Maven or existing), it always has no facets but java (and that in 1.5 not even 1.6), while it is supposed to be a webproject and have facelets & dynamic web project.
Can I change those facets? It seems to just work when I put java to 1.6, but trying to edit the dynamic web module version from 2.4 to 2.5 (it is standard on 2.4) without running into some troubles. Even after I just made a fresh maven project (with an archtype in commandline), I'm not able to change much about these facets.
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Eclipse 功能由项目元数据驱动。如果您没有正确的元数据,项目将无法正常运行。
如果您从头开始并在 Eclipse 中创建项目,请确保将所有元数据文件放置在源代码控制系统中(包括 [project]/.settings 目录下的所有内容)。
如果您使用 Maven 生成 Eclipse 项目元数据,请确保找到了解 WTP 的 Maven 插件。我没有参考资料,但我知道它存在。这将确保当 Maven 生成元数据时,它将拥有 Web 项目的正确元数据。
Facet 的工作方式是 Facet 作者可以选择不实现版本更改逻辑。不幸的是,Java EE 模块方面(例如动态 Web 模块)没有实现版本更改。其他方面(例如 Java)确实支持这一点。因此,您的体验会因方面而异。
如果所有其他方法都失败,您可以手动编辑 .settings/org.eclipse.wst.common.project.facet.core.xml 文件。确保从 Eclipse 执行此操作,否则您将需要随后刷新项目。请记住,如果您强制进行这样的更改,您可能需要对项目内容进行一些手动修复。例如,如果更改 Web 规范级别,则可能需要更新部署描述符。
Eclipse functionality is driven by project metadata. If you don't have the right metadata, the projects aren't going to behave correctly.
If you are starting from scratch and creating projects in Eclipse, make sure to place all of the metadata files in your source control system (including everything under [project]/.settings directory).
If you are using Maven to generate your Eclipse project metadata, make sure that you find the Maven plugin that knows about WTP. I don't have a reference, but I know it exists. This will ensure that when Maven generates metadata, it will have the correct metadata for web projects.
The way facet works is that the facet author can choose not to implement version change logic. Unfortunately the Java EE module facets (such as the dynamic web module) do not have version change implemented. Other facets like Java do support this. So your experience will vary from facet to facet.
If all else fails, you can edit .settings/org.eclipse.wst.common.project.facet.core.xml file by hand. Make sure to do that from Eclipse or you will need to refresh the project afterwards. Just keep in mind that if you are forcing the change like that, you might need to do some manual fixes to your project content. For instance, if you change web spec level, you may need to update the deployment descriptors.
您可以更改项目方面。您应该关闭 eclipse ,然后转到 .settings 目录, org.eclipse.wst.common.project.facet.core.xml 文件包含所有方面相关信息。您可以添加或删除项目构面。
You can change project facets. You should close eclipse , then goto .settings directory, org.eclipse.wst.common.project.facet.core.xml file holds all facets related info. You can add or remove a project facet .
对于 Eclipse
右键单击项目
并从出现的菜单中选择properties
在打开的窗口左侧有一个列表。
选择
项目构面
,您将看到可以选择并调整其设置的所有可用构面。for eclipse
Right click on the projec
t and chooseproperties
from the appearing menuThere is a list in the left side of the opening window.
Select
project facets
and you will see all available facets you can choose and adjust their settings.我最近将一个旧项目升级到 Java8/Eclipse 4.6.1,也遇到了侧面版本问题。为了获得@fmucar提到的菜单(在我安装的Eclipse for RCP and RAP Developers包中不可用),我必须安装新软件从帮助菜单中,然后选择添加Faceted Project Framework。然后我就可以从 IDE 中选择 Facet 版本。
I recently upgraded an old project to Java8/Eclipse 4.6.1, and also ran into a facet version issue. In order to get the menu mentioned by @fmucar (which was not available in the Eclipse for RCP and RAP Developers package I had installed), I had to do Install New Software from the Help Menu , and select to add Faceted Project Framework. I was then able to pick the facet version from the IDE.