(1)问题:
Description Resource Path Location Type Build path specifies execution environment J2SE-1.5.
There are no JREs installed in the workspace that are strictly compatible with this environment.
WinXin Build path JRE System Library Problem
(2)原因:
maven是项目管理工具,默认使用J2SE-1.5的库管理项目(我的是1.5,也可能是其他版本),
用maven-compiler-plugin插件,就是为了告诉maven使用什么版本的库来管理项目。
(3)解决办法:
1.在pom文件中加入以下代码
<build>
<finalName>WinXin</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>2.更新项目
右键项目/maven/update project/勾选 force update of snapshows/releases
本文介绍了解决Maven项目因默认使用不兼容的J2SE-1.5环境而导致的问题的方法。通过在pom.xml文件中指定maven-compiler-plugin插件来设置正确的Java版本,并提供了更新项目的步骤。
1422

被折叠的 条评论
为什么被折叠?



