1.创建Maven项目
2.保留或设置默认工作空间
3 选择模板骨架
对应Java项目
4.Group
id – 公司名倒序,Artifact
id – 项目名, package默认
5.项目创建完成,其中webapp相当于web项目的WebContent
6 Maven的主配置文件 pom.xml
注意:
由于Eclipse自带的 maven-archetype-webapp 1.0 骨架版本较老,所以需要
进行版本修复。
1.目录文件报错
Eclipse是因为默认JDK没有配置正确,所以隐藏的目录没有出来,修改默认的JDK版本
2.index.jsp 报错
缺少tomcat组件jar包
3.修改pom.xml文件,删除 test
4.需求高于web Module 2.5版本的架构
替换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"
version="3.0">
<display-name>DangDang_CMS</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
修改文件 .settings\org.eclipse.wst.common.project.facet.core.xml
5.在pom,xml文件中修改版本为 3.0
更新maven项目
一步步慢慢来。。。。。。。。。。