解决方案:
在pom文件中增加如下代码:
<build>
<plugins>
<plugin>
<groupId></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以上。
修改的文件
,
<installed facet="java" version="1.8"/>
<installed facet="" version="3.1"/>
,
project-version="1.8.0"
.
把1.5改为1.8
4.修改
<web-app xmlns="/xml/ns/javaee" xmlns:xsi="http:///2001/XMLSchema-instance"
xsi:schemaLocation="/xml/ns/javaee
/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