idea error:java: 无效的源发行版: 8
- 检查pom.xml
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> <encoding>utf8</encoding> </configuration> </plugin>
可以发现,pom.xml中要求的是jdk8,出错的原因就是idea中配置的jdk版本不是8
-
安装jdk1.8,过程略
-
修改idea中的配置:file–>project structure
-
file–>project structure
-
file–>settings
-
file–>settings
-
file–>settings
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>utf8</encoding>
</configuration>
</plugin>