Maven异常:Dynamic Web Module 3.0 requires Java 1.6 or newer.

来源:互联网 发布:淘宝客新建导购推广 编辑:程序博客网 时间:2024/06/06 14:03

问题

我目前用的JDK 是java 1.8 ,搭建Maven项目的时候,设置Project facets后,出现来以下problem : Dynamic Web Module 3.0 requires Java 1.6 or newer. 


然后尝试如下方案依然没有效果:

  1. Go to project Build Path and change the Java Library version to 1.7
  2. Go to Eclipse Preferences -> Java -> Compilre -> Change compliance level to 1.7 

  3. Right click on project -> Properties -> Project Facets
  4. Uncheck Dynamic Web Module and click Apply (also uncheck JavaServer Faces if you had that)
  5. Change the Java facet version to 1.8 and click Apply
  6. Add the Dyanmic Web Module v3.0, apply.

解决方案

经过反复试验,可以通过以下途径解决:
1.打开pom.xml
2.加入以下插件
 <plugin>    <artifactId>maven-compiler-plugin</artifactId>    <version>3.1</version>    <configuration>         <source>1.8</source>          <target>1.8</target>     </configuration></plugin>
3.右键点击项目->Maven->Update Project


异常消失了


0 0
原创粉丝点击