这是哪里错了 要怎么改

img


Java source 1.5中不支持使用try-with-resources(请使用- source7或更高版本以启用try-with-resources)

maven里面加入
<properties>
  <maven.compiler.source>1.8</maven.compiler.source>
</properties>

还有你项目的jdk版本也设置为1.8

img

编译版本太低,需要更新到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