-----------------------2018-07-02
背景:今天启动eclipse,发现项目报错。problems窗口有两个报错。
Q1:Dynamic web module 3.1 requires Java 1.7 or newer.
原因:eclipse的 java build path-->libraries下的编译版本是1.5,每次maven update project,就会默认使用1.5版本
尝试网上方法1:
eclipse-->右键项目-->build path -->configure bulid path-->
① java build path-->libraries,将JRE System Library [JavaSE-1.5] 改为JRE System Library [JavaSE-1.8]
(本机装的是1.8版本的jdk);
② java compiler,将JDK compliance 改为1.8;
结果:再次maven更新,报错没有解决。
尝试网上方法2:
eclipse-->项目,找项目的pom.xml文件,在<bulid> ...</bulid>标签中,添加以下的内容:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
(以上为设置maven的编译版本)
结果:再次maven更新,报错解决。
----------------------------------------------------------
Q2:
The project cannot built until build path errors are resolved.
Archive for required library:"G:/Mavenrepository/org\mybatis/mybatis/3.4.2/mybatis-3.4.2.jar" cannot be read or is not a vaild ZIP file.
解决:找到报错路径:G:/Mavenrepository/org\mybatis/mybatis/3.4.2/,将该路径下的内容全部删除,回到eclipse,重新更新maven-->update project(此时重新下载该jar包)
结果:报错解决
原因:不知道是什么原因,有了解的朋友可以留言告诉我,谢谢啦!