更新 maven 项目时,Eclipse Kepler 无法设置 Java jdk 1.8

Eclipse Kepler is unable to set the Java jdk 1.8 when maven project is updated

已安装java版本为1.8,在pom.xml中选择此版本并更新maven项目时,它会自动从1.8跳转到1.4,因此我无法使用特定的Lambda表达式代码。

我正在使用 eclipse kepler。

知道这里发生了什么吗?

在你的 pom.xml 文件中添加类似的内容。您可能需要调整插件版本。

<project> 
[...] 
    <build> 
    [...] 
        <plugins> 
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration> 
                    <source>1.8</source> 
                    <target>1.8</target>
                </configuration> 
            </plugin>
         </plugins> 
         [...] 
     </build>
 [...] 
</project>

抱歉,我在移动设备上,编辑器的代码格式很糟糕。

编辑:如已接受的答案中所述,您还需要 enable Java 8 support in Kepler

在 Hogler 上面的评论的帮助下,我能够解决这个问题

刚刚做了这个:

https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler