搭建maven web项目

1.新建maven项目

选择Archetype为 org.apache.maven.archetypes  manven.archetype.webapp,单击Next

2.更改文件结构

new source floder  src/main(test)/java(resource)

修改Build Path 配置在项目上,右键单击,选择 Build Path ->Configure Build Path

双击每个文件夹的Output folder,选择路径

src/main/java,src/main/resources,选择target /classes;
src/test/java ,src/test/resources, 选择target/test-classes;

修改JDK版本:选择 libraries 标签,选中JRE library,单击Edit按钮

3.转换为web项目  

project facets->Dynamic Web Module

WebContent目录改为src/main/webapp目录,添加web.xml

4.修改发布规则

Deployment assembly  

测试目录不发布 添加webapp和maven dependences

原文地址:https://www.cnblogs.com/weiwoduhigh/p/3364718.html