解决方案:
在pom文件中增加如下代码:
<build>
<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>
记录下遇到问题的过程
在用maven构建项目时遇到的问题,当我把 Web Module 版本改为3.1时,需要java版本在1.7以上。
修改的文件
1.or,g.eclipse.wst.common.project.facet.core.xml
<installed facet="java" version="1.8"/>
<installed facet="jst.web" version="3.1"/>
2.org.eclipse,wst.comon.component
project-version="1.8.0"
3.org.eclipse.m2e.wtp.prefs
把1.5改为1.8
4.修改web.xml
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1" metadata-complete="true">
</web-app>
修改了Build Path下java版本和项目java compiler中java版本后,执行MAVEN update project,发现错误不能解决,Build Path中的java版本变成了1.5,出现错误Resource Path Location TypeDynamic Web Module 3.1 requires Java 1.7 or newer,和Description Resource Path Location TypeOne or more constraints have not been