欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

-source 1.5 中不支持 lambda 表达式

程序员文章站 2022-06-24 20:02:11
...

maven为了兼容低版本所以采用了默认jdk1.5
如果使用新特性,需要指定一下jdk版本:
在项目根pom中添加一下配置即可

<build>
<plugins>
  <plugin>
                <groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
   </plugin>
  </plugins>
</build>