关于idea中使用lamb表达式报错:ambda expressions are not supported at this language level

我使用的是jdk1.8,使用lamb表达式的时候,报错

ambda expressions are not supported at this language level,

后来,设置了

接着重启了项目,在使用的过程中依然报错,后来查阅资料,说虽然设置了,但是idea默认还是1.5,关键的是需要在pom.xml文件中添加:

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

添加以上两段,重启,OK

猜你喜欢

转载自www.cnblogs.com/ylht/p/11032437.html
今日推荐