在Intellij idea中新建了一个Maven项目,运行时报错如下:Error : java 不支持发行版本5

修改Modules的JDK版本,若设置未生效,原因是设置被Maven配置覆盖

【Intellij IDEA 报错】Error : java 不支持发行版本5

解决办法:在pom文件中指定编译的JDk版本(以jdk1.9)

1、方式一

<properties>
        <maven.compiler.source>1.9</maven.compiler.source>
        <maven.compiler.target>1.9</maven.compiler.target>
</properties>

2、方式二

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

  

相关文章:

  • 2021-11-12
  • 2021-08-18
  • 2021-11-25
  • 2021-03-31
  • 2021-10-16
  • 2021-07-06
  • 2021-05-30
猜你喜欢
  • 2021-05-17
相关资源
相似解决方案