java: -source 1.5 中不支持 try-with-

2019-03-21  本文已影响0人  letsgetdrunk

报错:

Error:(19, 13) java: -source 1.5 中不支持 try-with-resources
  (请使用 -source 7 或更高版本以启用 try-with-resources)

在网上查阅解决方法

  1. File - Project Structure -Project - Language Level 更改为8
    无法解决。
  2. pom.xml 添加dependency
    无法解决。
  <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
  </properties>
  1. File - Project Structure -Modules- Language Level 更改为8
    解决。
上一篇 下一篇

猜你喜欢

热点阅读