-source 1.7不支持lambda表达式 [英] lambda expressions are not supported in -source 1.7
本文介绍了-source 1.7不支持lambda表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Eclipse中打开了maven项目.但是当我进行清洁和安装时,会遇到上述错误.
I have maven project opened in Eclipse. But when I do clean and install, I get above error.
我将构建路径更改为使用SE 1.8,并且将编译器也配置为使用1.8.您可以在以下屏幕截图中看到这一点.
I changed my build path to use SE 1.8 and my compiler is also configured to use 1.8. You can see that in following screen shots.
我也在项目浏览器中看到了一些小红叉.您可以在下图中看到它.
I am seeing little red crosses in project explorer too. You can see that in following picture.
我不确定将Maven配置为在Eclipse中使用SE 1.8时,为什么Maven使用SE 1.7.
I am not sure why maven is using SE 1.7 when I have configured it to use 1.8 in Eclipse.
推荐答案
您需要将maven配置为在编译时使用1.8兼容性:
You need to configure maven to use 1.8 compatibility when compiling:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>utf8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
这篇关于-source 1.7不支持lambda表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文