(转载)Intellij IDEA 报错:Error : java 不支持发行版本5
原文地址
在Intellij idea中新建了一个Maven项目,运行时报错如下:Error : java 不支持发行版本5
修改Modules的JDK版本,若设置未生效,原因是设置被Maven配置覆盖。
1、方式一
properties>
<maven.compiler.source>1.9</maven.compiler.source>
<maven.compiler.target>1.9</maven.compiler.target>
</properties>
2、方式二
<build><br> <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>