问题描述
        用Eclipse创建Maven结构的web项目的时候选择了Artifact Id为maven-artchetype-webapp,由于这个catalog比较老,用的servlet还是2.3的,而一般现在都是用3.0,在Project Facets里面修改Dynamic web module为3.0的时候就会出现Cannot change version of project facet Dynamic web module to 3.0,如图:


解决这个问题的步骤如下:
1. 把Servlet改成3.0,打开项目的web.xml
<?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">

2. 修改项目的设置,在Navigator下打开项目.settings目录下的org.eclipse.jdt.core.prefs
把1.5改成1.8
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. 打开org.eclipse.wst.common.project.facet.core.xml
把java改为1.8, 把jst.web改为3.0;
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="jst.web" version="3.0"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
  <installed facet="java" version="1.8"/>
</faceted-project>

OK,搞定了。

最新文章

  1. lable计算行高
  2. sql批量更换dedecms文章来源和作者
  3. iOS - UISearchController
  4. centos安装ftp
  5. thinkcmf thinkphp隐藏后台地址
  6. React-Native做一个文本输入框组件
  7. 巧用DISPLAY_AWR函数与dba_hist_sqlstat结合查询SQL语句在指定节点指定时间范围内的历史执行计划
  8. HDU 4126 Genghis Khan the Conqueror MST+树形dp
  9. 处理Block中的self问题(Capturing &#39;self&#39; strongly in this block is likely to lead to a retain cycle)
  10. vue2入坑随记(二) -- 自定义动态组件
  11. 【java多线程系列】java内存模型与指令重排序
  12. 改变RadioButton的文字位置以及距离
  13. CentOS7 Windows双系统 修复引导
  14. P4172 [WC2006]水管局长
  15. Android应用启动时Activity被创建两次
  16. 如何访问WEB-INFO目录中的jsp文件
  17. ZT Android4.2蓝牙基础架构学习
  18. 使用SQL语句的子查询批量复制表数据
  19. 第13课:HTML基础之DOM操作2
  20. [TJOI2017]DNA --- 后缀数组

热门文章

  1. 《Swift开发指南》
  2. Effective Java 51 Beware the performance of string concatenation
  3. python基本数据结构-集合-集合运算
  4. window10系统安装oracle11g时遇到INS-13001环境不满足最低要求
  5. 读书笔记——网络编程与开发技术(3)基于TCP/IP协议的网络编程相关知识
  6. subline 快捷键
  7. python strip() lstrip() rstrip() 使用方法
  8. Linux学习之三——操作档案与目录
  9. Linux Bash shell one practice : array if else
  10. 二分+动态规划 POJ 1973 Software Company