maven里面加入
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
还有你项目的jdk版本也设置为1.8
编译版本太低,需要更新到jdk1.7或者更高,修改pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
或者在IDEA设置File - Project Structure -Modules- Language Level 更改为8