Eclipse中安装JRE,Preferences > Java > Installed JREs,点击 Add,并添加自己的Java路径

确认编译器版本不低于1.6,右键项目 > Properties > java Compiler,保证“Compiler compliance level”不低于1.6。

保证项目的Facet中Java版本不低于1.6,右键项目 > Properties > MyEclipse > Project Facets > Java,保证“Java”不低于1.6。

更改Pom.xml 设定运行时的maven和jdk版本
<!-- 官方文档 -->
<!-- http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5</version>
<configuration>
<!-- 指定source和target的版本 -->
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
网友评论