Eclipse Maven 编译错误 Dynamic Web Module 3.0 requires Java 1.6 or newer 解决方案_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > Eclipse Maven 编译错误 Dynamic Web Module 3.0 requires Java 1.6 or newer 解决方案

Eclipse Maven 编译错误 Dynamic Web Module 3.0 requires Java 1.6 or newer 解决方案

 2017/6/28 5:58:43  whenjun  程序员俱乐部  我要评论(0)
  • 摘要:转自:http://blog.csdn.net/defonds/article/details/47974269EclipseMaven开发一个jee项目时,编译时遇到以下错误:DescriptionResourcePathLocationTypeDynamicWebModule3.0requiresJava1.6ornewer
  • 标签:解决方案 Web 解决 Eclipse 编译 Java 错误 Maven

转自:http://blog.csdn.net/defonds/article/details/47974269

?

Eclipse Maven 开发一个 jee 项目时,编译时遇到以下错误:
DescriptionResourcePathLocationType
Dynamic Web Module 3.0 requires Java 1.6 or newer.bdpline 1Maven Java EE Configuration Problem

DescriptionResourcePathLocationType
One or more constraints have not been satisfied.bdpline 1Maven Java EE Configuration Problem

如图:
Dynamic Web Module 3.0 requires Java 1.6 or newer
但是 Eclipse 明明已经将编译级别设置为 1.7:
Eclipse compiler
这是由于你的 Maven 编译级别是 jdk1.5 或以下,而你导入了 jdk1.6 以上的依赖包:查看 Eclipse 的 Navigator 视图下该项目的 .classpath 文件:

[html]?view plain?copy ? ?print?
  1. <classpathentry?kind="con"?path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">??
  2. ????<attributes>??
  3. ????????<attribute?name="maven.pomderived"?value="true"/>??
  4. ????</attributes>??
  5. </classpathentry>??


解决办法:
使用 maven-compiler-plugin 将 maven 编译级别改为 jdk1.6 以上:

[html]?view plain?copy ? ?print?
  1. <build>??
  2. ????<plugins>??
  3. ????????<!--?define?the?project?compile?level?-->??
  4. ????????<plugin>??
  5. ????????????<groupId>org.apache.maven.plugins</groupId>??
  6. ????????????<artifactId>maven-compiler-plugin</artifactId>??
  7. ????????????<version>2.3.2</version>??
  8. ????????????<configuration>??
  9. ????????????????<source>1.7</source>??
  10. ????????????????<target>1.7</target>??
  11. ????????????</configuration>??
  12. ????????</plugin>??
  13. ????</plugins>??
  14. </build>??


参考资料

  • http://stackoverflow.com/questions/12857535/eclipse-maven-update-causes-corruption-of-jvm-setting
  • http://stackoverflow.com/questions/5783338/what-is-the-use-of-org-eclipse-jdt-launching-jre-container-in-eclipse
发表评论
用户名: 匿名