简体   繁体   English

无法将项目构面Java版本更改为1.7(选项不可用)

[英]Cannot change project facet java version to 1.7 (Option not available)

So I have a project where the Java Compiler being used is 1.7. 所以我有一个项目,其中使用的Java编译器为1.7。 But in the project facet the Java version is 1.6. 但是在项目方面,Java版本是1.6。 So I get the following error: 所以我得到以下错误:

在此处输入图片说明

So I have 2 choices, I can either change my compiler version down to 1.6 or I can change my project facet version up to 1.7. 因此,我有2个选择,我可以将编译器版本更改为1.6,也可以将项目构面版本更改为1.7。 I don't want to do the former though, when I change my compiler level down to 1.6 then I can't use diamond operators and, well I want all those java 7 features! 我不想做前者,当我将编译器级别降低到1.6时,我将无法使用菱形运算符,而且,我想要所有这些Java 7功能! So, I need to change my facet version up to 1.7. 因此,我需要将facet版本更改为1.7。 But alas, when I try and do it, 1.7 isn't even available: 但是,a,当我尝试这样做时,1.7甚至不可用:

在此处输入图片说明

So I ask you... why? 所以我问你...为什么? :\\ :\\

Sorry... I don't know why that is happening... I had similar problem today. 抱歉...我不知道为什么会这样...我今天有类似的问题。

But to fix your problem, you can go to yourproject/.settings/org.eclipse.wst.common.project.facet.core.xml and change there manually. 但是要解决您的问题,您可以转到yourproject / .settings / org.eclipse.wst.common.project.facet.core.xml并手动进行更改。 refresh your project and it should be good to go. 刷新您的项目,应该很好。 :) :)

You will be looking for something like 您将寻找类似的东西

<installed facet="java" version="1.7"/>

for maven project you can add such properties 对于Maven项目,您可以添加此类属性

 <properties>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
 </properties>

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

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