Maven学习篇一:eclipse构建运行maven web项目

1.new-》other-》maven project-》next

2.选择创建简单项目(或者直接去掉勾,在后面选择maven-archetype-webapp)

3.设置坐标,名称

4.选择项目,(检查是否为web项目,如果不是进行转换)右键--》Project Facets-》

 5.检查部署路径和依赖

6.添加WEB-INF/web.xml,index首页

 7.部署tomcat运行

8.启动Ok

9.使用jetty插件运行

<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.16.v20140903</version>
<configuration>
<scanIntervalSeconds>5</scanIntervalSeconds><!-- 配置表示新代码的扫描时间间隔(秒),值 <= 0 表示不扫描 -->
<webApp>
<contextPath>/test</contextPath><!-- 工程的虚拟目录名 -->
</webApp>
</configuration>
</plugin>
</plugins>
</build>

10.部署运行(配置运行命令以及端口号:jetty:run -Djetty.port=9080)

 11.通过虚拟目录访问:

 

 maven-simple.web.rar

原文地址:https://www.cnblogs.com/brant/p/5727698.html