首页 > 其他分享 >Try-with-resources are not supported at language level '5'

Try-with-resources are not supported at language level '5'

时间:2022-08-18 11:47:00浏览次数:76  
标签:maven language level supported Try resources

Try-with-resources are not supported at language level '5'
没有指定maven版本导致 的

指定maven版本


没有指定maven版本导致 的

指定maven版本就可以

//再try()中写代码报错
try (SqlSession session  = sqlSessionFactory.openSession()) {
            
}

解决方法:

<plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-compiler-plugin</artifactId>
     <configuration>
         <source>8</source>
         <target>8</target>
     </configuration>
</plugin>

标签:maven,language,level,supported,Try,resources
From: https://www.cnblogs.com/xiaoqigui/p/16598100.html

相关文章