try中定义输入流报错:Try-with-resources are not supported at language level '5'

报错现象:

处理过程:

1、先是查看了Project Structure,发现设置的都是1.8

2、然后又查看了Settings->Build,Execution,Deployment->Compiler->Java Compiler,发现设置的也是8

3、修改pom文件,在project下添加如下配置,问题解决:

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

 

  

posted @ 2020-01-19 20:26  海*风  阅读(1576)  评论(0编辑  收藏  举报