-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>