运行maven 时 出现error:不支持 发行版本 X
在运行 maven 项目时,出现错误 不支持 发行版本 X,一般是 项目 版本与 pom.xml 配置文件中不一致
编辑当前项目的 jdk 版本,Ctrl + Alt + Shift + s ,进入项目结构设置
Ctrl + Alt + s 进入设置,找到构建,执行,部署 / Java 编译器
在 pom.xml 文件中加入以下配置
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<!--java版本,我使用的是1.8 -->
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
让所有版本保持一致即可