使用Maven工具,报错 Cannot change version of project facet Dynamic Web Module to 3.0 解决

  • 基本有这些类型:
Cannot change version of project facet Dynamic Web Module to 3.0.

Java compiler level does not match the version of the installed Java project facet.

One or more constraints have not been satisfied.

Project configuration is not up-to-date with pom.xml. Select: Maven->Update Project... from the project context menu or use Quick Fix.

Dynamic Web Module 3.0 requires Java 1.6 or newer.

Java compiler level does not match the version of the installed Java project face
  • 是maven项目在eclipse里以web项目部署出错,转化版本失败。Dynamic Web Module版本不对,或者java版本不对。在这个时候,据查阅,只需要改3个地方就可以完美解决这个问题。

  • eclipse中打开Navigator文档模式,在windows--show view--Navigator


    image.png
image.png
  • 修改web.xml,src/main/webapp/WEB-INF/web.xml,修改Dynamic Web Module版本。
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xmlns="http://java.sun.com/xml/ns/javaee" 
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
         id="schedule-console" version="3.0">
  <display-name>Archetype Created Web Application</display-name>
</web-app>
  • 修改pom.xml文件,在bulid里添加java版本依赖。
<build>
    <finalName>contentplatform</finalName>
    <plugins>  
        <plugin>  
            <groupId>org.apache.maven.plugins</groupId>  
            <artifactId>maven-compiler-plugin</artifactId>  
            <version>2.3.2</version>  
            <configuration>  
                <source>1.8</source>  
                <target>1.8</target>  
            </configuration>  
        </plugin>  
    </plugins> 
  </build>
  • 右键 -- maven -- update project...。这个时候基本都会没问题了。有也是小问题,继续修改下java配置即可。
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容