IDEA运行项目时出现java不支持发行版本5

如图 原因是项目使用的jdk版本与本地的jdk环境不同导致,解决方案有两种:

一. 需要修改配置

修改为使用的jdk版本

同时修改项目结构中的jdk版本

为了避免每次都需要重新设置,可以在默认设置中修改项目环境均为本地jdk环境

二.

    在工程的pom.xml中添加 <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> 或者,添加properties节点
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>
经验分享 程序员 微信小程序 职场和发展