Project facet Dynamic Web 3.1
程序员文章站
2022-07-03 23:33:46
...
If you want to use servlet-api on version 3.1 you need to use the following schema:
Note that 3.0 and 3.1 are different: in 3.1 there's no Sun mentioned, so simply changing 3_0.xsd to 3_1.xsd won't work
<?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">
</web-app>
Also, make sure you're depending on the latest versions in your pom.xml. That is,
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
and
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
or
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
Also, you should compile with Java 7 or 8:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source><!--源代码使用的开发版本 -->
<target>1.8</target><!-- 需要生成的目标class文件的编译版本 -->
<!-- 一般而言,target与source是保持一致的,但是,有时候为了让程序能在其他版本的jdk中运行(对于低版本目标jdk,源代码中需要没有使用低版本jdk中不支持的语法),会存在target不同于source的情况 -->
<!-- 这下面的是可选项 -->
<meminitial>128m</meminitial>
<maxmem>512m</maxmem>
<fork>true</fork> <!-- fork is enable,用于明确表示编译版本配置的可用 -->
<compilerVersion>1.3</compilerVersion>
<!-- 这个选项用来传递编译器自身不包含但是却支持的参数选项 -->
<compilerArgument>-verbose -bootclasspath ${java.home}\lib\rt.jar</compilerArgument>
</configuration>
</plugin>
转载于:https://my.oschina.net/ordinance/blog/603357
推荐阅读
-
eclipse配置tomcat开发Dynamic Web Project环境图解
-
Cannot change version of project facet Dynamic Web Module to 3.0
-
Cannot change version of project facet Dynamic Web Module to 3.0
-
Cannot change version of project facet Dynamic Web Module to *
-
Project facet Dynamic Web 3.1
-
Cannot install Dynamic Web Module 2.5 facet. It is incompatibile with already installed facets:..
-
Eclipse——web项目没有Run On Server以及project facets 里没有Dynamic Web Module解决方法
-
动态网站项目(Dynamic Web Project)CRUD(增删改查)功能的实现(mvc(五层架构)+jdbc+servlet+tomcat7.0+jdk1.8),前端使用JSP+JSTL+EL组合
-
动态web项目(Dynamic Web Project)的springmvc第一个项目(一)
-
eclipse中创建web项目时不能创建 Dynamic web project的解决方案(亲测有效)