我已经在Eclipse Helios版本下创建了一个新的动态项目,其中我的JRE版本设置为1.6。 我已经通过单击Configure→Convert to Maven Project向Web应用程序添加了Maven功能。

添加后,Eclipse Problems视图中出现了一个构建错误:

Java compiler level does not match the version of the installed Java project facet.
Unknown Faceted Project Problem (Java Version Mismatch)

请告诉我如何解决这个错误(我想有我的JRE版本为1.6)。


当前回答

如果您的项目不是Maven项目,右键单击您的项目并选择Properties打开project Properties对话框。

左边有一个Project Facets项,选择它,在列表中查找Java facet,选择您想要用于项目的版本并应用。

其他回答

右键单击项目并选择属性 从左边单击java编译器,并更改为所需的版本 希望这能有所帮助

TK Gospodinov answer is correct even for maven projects. Beware: I do use Maven. The pom was correct and still got this issue. I went to "Project Facets" and actually removed the Java selection which was pointing to 1.6 but my project is using 1.7. On the right in the "Runtimes" tab I had to check the jdk1.7 option. Nothing appeared on the left even after I hit "Apply". The issue went away though which is why I still think this answer is important of the specific "Project Facets" related issue. After you hit OK if you come back to "Project Facets" you will notice Java shows up as version 1.7 so you can now select it to make sure the project is "marked" as a Java project. I also needed to right click on the project and select Maven|Update Project.

Project Facet->Java应该与maven-compiler-plugin工件源和目标的pom.xml中的任何内容相匹配。这太完美了。但是如果你在这里没有它,那么你也可以通过匹配Java编译器版本在项目方面的设置:Eclispe->首选项->Java->编译器

您可以从更改项目方面 项目——>属性——>项目Facet——> Java——>{所需的JDK版本}

如果使用eclipse,

下。设置单击org.eclipse.wst.common.project.facet.core.xml

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <installed facet="java" version="1.7"/>
</faceted-project>

请修改为正确的版本。