项目方面 java 1.8 版本不存在
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21955207/
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
Version 1.8 of project facet java does not exist
提问by Svetlin Zarev
I'm trying to build a Dynamic Web Application
in eclipse using Java 8 (and Wildfly appServer if that matters) but I'm unable to make Eclipse Luna M5 use Java 8 (I do have Java 8 BETA support installed and it works on JavaSE projects).
我正在尝试Dynamic Web Application
使用 Java 8(如果重要的话,还有 Wildfly appServer)在 Eclipse 中构建一个,但我无法让 Eclipse Luna M5 使用 Java 8(我确实安装了 Java 8 BETA 支持并且它适用于 JavaSE 项目)。
In my POM I set the level to Java 8:
在我的 POM 中,我将级别设置为 Java 8:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
But after I do maven -> update project
I get the following error:
但是在我这样做之后,maven -> update project
我收到以下错误:
Could not update project ExampleApp configuration
Version 1.8 of project facet java does not exist.
And indeed there is no java 1.8 project facet under project->preferences->project facets->java
而且确实没有java 1.8 project facet下 project->preferences->project facets->java
Can I manually create such facet
and add It to to eclipse or I'll have to wait until java 8 is released and the eclipse guys decide to add it ?
我可以手动创建这样的facet
并将其添加到 eclipse 中,还是必须等到 java 8 发布并且 eclipse 人员决定添加它?
采纳答案by Poorna
There are additional patches available for Kepler SR2 officially. In ecliplse, go to "Help" --> "Market Place" --> Search for java 8 kepler. Then choose and install the following.
官方提供了适用于 Kepler SR2 的其他补丁。在 ecliplse 中,转到“帮助”-->“市场”--> 搜索 java 8 kepler。然后选择并安装以下内容。
- install Java 8 support eclipse kepler sr2,
- Java 8 Facets for web tools eclipse kepler sr2
- Java 8 support for m2e for Eclipse Kepler SR2 (if required)
- 安装 Java 8 支持 eclipse kepler sr2,
- 用于 Web 工具的 Java 8 Facets eclipse kepler sr2
- Java 8 支持 Eclipse Kepler SR2 的 m2e(如果需要)
Reference: http://www.eclipse.org/downloads/java8/
参考:http: //www.eclipse.org/downloads/java8/
After this, my multi-module maven project with java 8 is building fine without any error in eclipse kepler SR2.
在此之后,我的带有 java 8 的多模块 maven 项目在 eclipse kepler SR2 中构建良好,没有任何错误。
UPDATE: If you are using Spring Tool Suite (STS), then version 3.5.1 has included these features.
更新:如果您使用的是 Spring Tool Suite (STS),则 3.5.1 版已包含这些功能。
回答by stevestorey
While we await official Java 1.8 support, I've made a github fork that contains what I believe are the required changes - these require the Java 8 patches from here first: https://wiki.eclipse.org/JDT_Core/Java8
在我们等待官方 Java 1.8 支持的同时,我制作了一个 github 分支,其中包含我认为所需的更改 - 这些首先需要来自此处的 Java 8 补丁:https: //wiki.eclipse.org/JDT_Core/Java8
To install the 1.8 facet support (assuming that you're running 4.3.1 or 4.3.2, and have write access to the main .../eclipse/plugins dir):
要安装 1.8 facet 支持(假设您运行的是 4.3.1 或 4.3.2,并且对主 .../eclipse/plugins 目录具有写访问权限):
- git clone https://github.com/stevestorey/webtools.common.fproj
- git checkout java8-support
- Import the various projects in this feature set into your Eclipse IDE (can be on a new workspace). Specifically you need org.eclipse.wst.common.project.facet.core and org.eclipse.wst.common.project.facet.core
- Right click on the org.eclipse.jst.common.project.facet.core project and choose "Export" and then "Plug-in development\Deployable plugins and fragments"
- From the Export dialog, select only the org.eclipse.jst.common.project.facet.core plugin, and choose the bottom "Install into host" radio button, and choose a suitable path (I believe I went with the default, but I don't think it particularly matters)
- Clicking Finish will build the plugin, and then kick off the installation into your Eclipse environment.
- git 克隆https://github.com/stevestorey/webtools.common.fproj
- git checkout java8-support
- 将此功能集中的各种项目导入您的 Eclipse IDE(可以位于新工作区中)。具体来说,您需要 org.eclipse.wst.common.project.facet.core 和 org.eclipse.wst.common.project.facet.core
- 右键单击 org.eclipse.jst.common.project.facet.core 项目并选择“导出”,然后选择“插件开发\可部署插件和片段”
- 从“导出”对话框中,仅选择 org.eclipse.jst.common.project.facet.core 插件,然后选择底部的“安装到主机”单选按钮,然后选择合适的路径(我相信我使用了默认值,但是我认为这不是特别重要)
- 单击 Finish 将构建插件,然后开始安装到您的 Eclipse 环境中。
After restarting Eclipse, you should find that 1.8 is now selectable as a Java facet :) (and it also works with M2E enabled projects that specify source/target of 1.8).
重新启动 Eclipse 后,您应该会发现现在可以选择 1.8 作为 Java facet :)(它也适用于将源/目标指定为 1.8 的启用 M2E 的项目)。
Note the instruction from the standard 1.8 patch instructions that the installed JDK /must/ be called "JavaSE-1.8" within the Eclipse properties.
请注意标准 1.8 补丁说明中的说明,即安装的 JDK /must/ 在 Eclipse 属性中称为“JavaSE-1.8”。
Also note that if/when you update Eclipse (e.g. to upgrade to 4.3.2), you will probably need to re-install the patched version again as the update will put the "official" version of the plugin back in.
另请注意,如果/当您更新 Eclipse(例如升级到 4.3.2)时,您可能需要再次重新安装修补版本,因为更新会将插件的“官方”版本放回原处。
回答by user3371721
I hit exactly the same problem a few days ago. Looks like this will be included into the next release of Eclipse Luna.
几天前我遇到了完全相同的问题。看起来这将包含在 Eclipse Luna 的下一个版本中。
Java Version 1.8 of project facet java does not exist
Eclipse Luna M6 is scheduled for release on March 14th so hopefully it will be included then.
Eclipse Luna M6 计划于 3 月 14 日发布,因此希望届时将包含在内。
回答by Yannick Mauray
There is an official bug report/patch for Kepler SR2. It also works with Spring Tool Suite 3.5.0.RC4 (which is based on Kepler). It should work for Luna too.
Kepler SR2 有一个官方错误报告/补丁。它还适用于 Spring Tool Suite 3.5.0.RC4(基于 Kepler)。它也应该适用于 Luna。
Bug report : https://bugs.eclipse.org/bugs/show_bug.cgi?id=430637(see comment #12)
错误报告:https: //bugs.eclipse.org/bugs/show_bug.cgi?id =430637(见评论 #12)
Update site for the Java 8 facet : http://download.eclipse.org/webtools/patches/drops/R3.5.2/P-3.5.2-20140329045715/repository
Java 8 方面的更新站点:http: //download.eclipse.org/webtools/patches/drops/R3.5.2/P-3.5.2-20140329045715/repository
回答by Gene
Recently Java updated to Java 8 so you need to update to the new Eclipse for it to work. I was running Eclipse 4.3 (Kepler) and I had to upgrade to Eclipse 4.4 (Luna)
最近 Java 更新到 Java 8,因此您需要更新到新的 Eclipse 才能使其工作。我正在运行 Eclipse 4.3 (Kepler),我不得不升级到 Eclipse 4.4 (Luna)
回答by Parshva Mehta
Go to Your Project Propertysearch for project facetand change java version
转到您的项目属性搜索项目方面并更改 java 版本