Eclipse Maven 编译错误 Dynamic Web Module 3.0 requires Java 1.6 or newer 解决方案
2017-03-02 16:26
447 查看
Eclipse Maven 开发一个 jee 项目时,编译时遇到以下错误:
Description
Resource Path
Location Type
Dynamic Web Module 3.0 requires Java 1.6 or newer.
bdp line 1
Maven Java EE Configuration Problem
Description Resource
Path Location
Type
One or more constraints have not been satisfied.
bdp line 1
Maven Java EE Configuration Problem
如图:
但是 Eclipse 明明已经将编译级别设置为 1.7:
这是由于你的 Maven 编译级别是 jdk1.5 或以下,而你导入了 jdk1.6 以上的依赖包:查看 Eclipse 的 Navigator 视图下该项目的 .classpath 文件:
[html] view
plain copy
print?
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
解决办法:
使用 maven-compiler-plugin 将 maven 编译级别改为 jdk1.6 以上:
[html] view
plain copy
print?
<build>
<plugins>
<!-- define the project compile level -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
Description
Resource Path
Location Type
Dynamic Web Module 3.0 requires Java 1.6 or newer.
bdp line 1
Maven Java EE Configuration Problem
Description Resource
Path Location
Type
One or more constraints have not been satisfied.
bdp line 1
Maven Java EE Configuration Problem
如图:
但是 Eclipse 明明已经将编译级别设置为 1.7:
这是由于你的 Maven 编译级别是 jdk1.5 或以下,而你导入了 jdk1.6 以上的依赖包:查看 Eclipse 的 Navigator 视图下该项目的 .classpath 文件:
[html] view
plain copy
print?
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
解决办法:
使用 maven-compiler-plugin 将 maven 编译级别改为 jdk1.6 以上:
[html] view
plain copy
print?
<build>
<plugins>
<!-- define the project compile level -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
相关文章推荐
- 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 解决方案
- 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 解决方案
- 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 解决方案
- 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 解决方案
- 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 解决方案
- Eclipse Maven 编译错误 Dynamic Web Module 3.0 requires Java 1.6 or newer 解决方案
- Eclipse jdk1.7 Maven 编译错误 Dynamic Web Module 3.0 requires Java 1.6 or newer 解决方案
- Maven 编译错误 Dynamic Web Module 3.0 requires Java 1.6 or newer 解决方案
- 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
- Eclipse Maven 编译错误 Dynamic Web Module 3.0 requires Java 1.6 or newer 解决方案 (特别注意))
- (转) Eclipse Maven 编译错误 Dynamic Web Module 3.1 requires Java 1.7 or newer 解决方案
- 解决 "检出Maven项目web.xml is missing"错误 和 “Dynamic Web Module 3.0 requires Java 1.6 or newer.”错误
- eclipse解决mevan项目”Dynamic Web Module 3.0 requires Java 1.6 or newer”错误
- Maven项目 Eclipse报Dynamic Web Module 3.1 requires Java 1.7 or newer错误解决方案