Error:JDK1.8 Cannot change version of project facet Dynamic Web Module to 3.1.

简介: 问题: Error:JDK1.8 Cannot change version of project facet Dynamic Web Module to 3.1. 此工程为名为mybatis:maven webapp project:'mybatis':解决检查以下文件中配置的,参数: 解决设置1:设置\src\main\webapp\WEB-INF\web.xml <?

问题:

Error:JDK1.8 Cannot change version of project facet Dynamic Web Module to 3.1.

此工程为名为mybatis:maven webapp project:'mybatis':解决检查以下文件中配置的,参数:

解决设置1:设置\src\main\webapp\WEB-INF\web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
                http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee">

解决设置2:eclipse的workspace下,\workspace\mybatis\.settings\org.eclipse.jdt.core.prefs

eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8
解决设置3:eclipse的workspace下,\workspace\mybatis\.settings\org.eclipse.wst.common.component
<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="mybatis">
        <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
        <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
        <property name="context-root" value="mybatis"/>
        <property name="java-output-path" value="/mybatis/target/classes"/>
    </wb-module>
</project-modules>
解决设置4:eclipse的workspace下,\workspace\mybatis\.settings\org.eclipse.wst.common.project.facet.core.xml
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="java" version="1.8"/>
  <installed facet="jst.web" version="3.1"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
解决操作5:eclipse菜单, Project下clean..., 项目右键后 refresh

解决操作6:项目右键,properties:java build path:jdk SE -> jdk workspace default JRE设置本机的设有环境变量的JDK

解决操作7:项目右键,properties:选择Project Facets java -> 1.8 和选择Dynamic Web Module ->3.1

解决设置8[可选]:设置 pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>demo.mybatis</groupId>
  <artifactId>mybatis</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>mybatis Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
    <scope>provided</scope>
	</dependency>
  </dependencies>
  <build>
    <finalName>mybatis</finalName>
    <plugins>
    <plugin>
	    <groupId>org.apache.maven.plugins</groupId>
	    <artifactId>maven-compiler-plugin</artifactId>
	    <version>3.1</version>
	    <configuration>
	        <source>1.8</source>
	        <target>1.8</target>
	    </configuration>
	</plugin>
    </plugins>
  </build>
</project>


目录
相关文章
|
12月前
|
Python
python2 pip2 No module named web
python2 pip2 No module named web
45 0
|
Java 数据库 Spring
【异常】because it is a JDK dynamic proxy that implements
【异常】because it is a JDK dynamic proxy that implements
231 0
|
6月前
An error happened during template parsing (template: “ServletContext resource [/WEB-INF/templates/in
An error happened during template parsing (template: “ServletContext resource [/WEB-INF/templates/in
|
网络安全
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://xxxx.svc.cluster.local:8080/xxxx": Connection reset; nested exception is java.net.SocketException: Connection reset 什么原因导致得
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "xxxx.svc.cluster.local:8080/xxxx ": Connection reset; nested exception is java.net.SocketException: Connection reset 什么原因导致得
1894 0
|
2月前
|
Oracle Java 关系型数据库
Linux下JDK环境的配置及 bash: /usr/local/java/bin/java: cannot execute binary file: exec format error问题的解决
如果遇到"exec format error"问题,文章建议先检查Linux操作系统是32位还是64位,并确保安装了与系统匹配的JDK版本。如果系统是64位的,但出现了错误,可能是因为下载了错误的JDK版本。文章提供了一个链接,指向Oracle官网上的JDK 17 Linux版本下载页面,并附有截图说明。
Linux下JDK环境的配置及 bash: /usr/local/java/bin/java: cannot execute binary file: exec format error问题的解决
|
3月前
|
Java 开发工具
开发工具系类 之 Cannot determine path to ‘tools.jar‘ library for 17 (D:/Program Files/Java/jdk-17.0.9)
这篇文章讲述了作者在升级JDK至17版本后遇到IDEA无法识别`tools.jar`的问题,并提供了两种解决方法:升级IDEA版本或降低JDK版本,并提供了相关版本的IDEA兼容性信息。
开发工具系类 之 Cannot determine path to ‘tools.jar‘ library for 17 (D:/Program Files/Java/jdk-17.0.9)
|
4月前
|
Java
关于idea报错:Cannot determine path to 'tools.jar' library for 17 (E:\java-jdk\jdk17)的解决办法
关于idea报错:Cannot determine path to 'tools.jar' library for 17 (E:\java-jdk\jdk17)的解决办法
|
3月前
|
前端开发 JavaScript
【Azure 环境】前端Web通过Azure AD获取Token时发生跨域问题(CORS Error)
【Azure 环境】前端Web通过Azure AD获取Token时发生跨域问题(CORS Error)
|
4月前
|
Oracle Ubuntu Java
cannot execute binary jdk问题
【7月更文挑战第15天】
352 5
|
5月前
|
Java
JDK version和class file version对应关系
JDK version和class file version对应关系