(转) Eclipse Maven 编译错误 Dynamic Web Module 3.1 requires Java 1.7 or newer 解决方案

场景:在导入Maven项目时候遇到如下错误。

1 问题描述及解决

Eclipse Maven 开发一个 jee 项目时,编译时遇到以下错误
Description Resource Path Location Type
Dynamic Web Module 3.1 requires Java 1.7 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.6 或以下,而你导入了 jdk1.7 以上的依赖包:查看 Eclipse 的 Navigator 视图下该项目的 .classpath 文件:

解决办法:

使用 maven-compiler-plugin 将 maven 编译级别改为 jdk1.7 以上:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
        <source>1.7</source>
        <target>1.7</target>
    </configuration>
</plugin>

最后执行 Maven -> Update Project,即可解决该问题。

时间: 2024-12-17 10:30:15

(转) Eclipse Maven 编译错误 Dynamic Web Module 3.1 requires Java 1.7 or newer 解决方案的相关文章

MAVEN Dynamic Web Module 3.0 requires Java 1.6 or newer.

MyEclipse2015中在使用Maven创建web项目时,会出现错误提示:Dynamic Web Module 3.0 requires Java 1.6 or newer. 解决方案: 在pom.xml文件中添加插件: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version&

问题解决——maven出现“Dynamic Web Module 3.0 requires Java 1.6 or newer.”错误

在ubuntu下使用maven搭建web项目,需要用到tomcat服务器来运行.所以需要"项目--右键--配置--Maven Project Facets--勾选Dynamic Web Module 但会出现提示Dynamic Web Module 3.0 requires Java 1.6 or newer.开始是以为我的jdk的问题,但jdk确实没有问题,是1.7的版本. 解决方法: 在pom.xml的<build><build>之间加入一段配置内容 <buil

[maven] &quot;Dynamic Web Module 3.0 requires Java 1.6 or newer.&quot; OR &quot;JAX-RS (REST Web Services) 2.0 requires Java 1.6 or newer.&quot;

在网上下载的开源工程,用maven构建的时候报错: Dynamic Web Module 3.0 requires Java 1.6 or newer. JAX-RS (REST Web Services) 2.0 requires Java 1.6 or newer. 即使你把properties->Java Compiler->Complier compliance level设置为1.7或1.8也不管用. 解决方法: 第一步,在pom.xml中定义jdk的版本,如下 <build&

maven3 在创建web项目时:Dynamic Web Module 3.0 requires Java 1.6 or newer 错误

问题:如图,在配置web项目时出现Dynamic Web Module 3.0 requires Java 1.6 or newer 错误 出现该问题是由于maven在构建的时候采用默认的jdk1.5 解决: 1.修改maven的构建在项目的pom.xml,在<build></build>标签中添加 <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <a

maven 构建项目时出错 “Dynamic Web Module 3.1 requires Java 1.7 or newer” in Eclipse

记录一下,水平太菜,花费了半天时间. pom.xml <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source&

【终极】Dynamic Web Module 3.0 requires Java 1.6 or newer

今天在用maven+ssm做项目的时候,右键项目properities设置project facet,勾选dynamic WEB module时一直勾不上,网上找了很多教程都不行, 有说在pom.xml添加plugin的: 也有说修改项目.setting目录下的eclipse配置的: 但是试了都是不行,后来找了其它项目参照,发现没有勾选java...

解决“Dynamic Web Module 3.0 requires Java 1.6 or newer.”错误

错误截图如下. eclipse maven  在项目的pom.xml的<build></build>标签中加入: <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <

“Dynamic Web Module 3.0 requires Java 1.6 or newer.”错误 (转别人)

eclipse maven 在项目的pom.xml的<build></build>标签中加入: <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configur

eclipse中maven项目的问题:解决Dynamic Web Module x.x requires Java x.x or newer.的问题

昨晚上close project 后,今天起来open project发现出现这个问题.现在解决了. 强调一下.之前用eclipse创建maven项目的时候,web.xml文件默认版本是2.3的,但是我改成了3.1的,具体修改是: 到tomcat找到web.xml复制里面的这个过来就行了. 解决方案: 第一:添加下面的配置到 pom.xml中. <build> <plugins> <plugin> <groupId>org.apache.maven.plug