您的位置:首页 > 产品设计 > UI/UE

MAVEN ERROR : Dynamic Web Module 3.0 requires Java 1.6 or newer

2016-05-09 14:13 501 查看
问题:


  在eclipse中,通过Maven->Update Project更新项目后,出现Dynamic Web Module 3.0 requires Java 1.6 or newer错误提示,发现项目Java Compiler中的版本回到1.5。



原因:


  其实在Maven官方文档中,Maven 3.0 source和target的默认设置都是1.5,与运行Maven时的JDK版本无关,除非在项目的POM文件中显示的指定一个版本,否则每次更新后都会使用编译器默认的source/target版本1.5。



解决方案:


  在pom中指定JDK版本,在哪儿指定,compiler-plugin中。



<!-- 官方文档 -->
<!-- http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<!-- 指定source和target的版本 -->
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: