-
新建一个maven web项目
-
修改pom.xml文件
<build>
<plugins>
<!-- 配置Tomcat插件:
就是本地部署,将tomcat 内嵌到 web项目中,这样可以直接运行 webapp项目。
跟类似spring boot 项目一样,不需要再部署到额外的tomcat,直接就可以运行了。-->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<!-- 不需要上下文 http://localhost:8080/xxx.jsp -->
<path>/</path>
<port>8080</port>
</configuration>
</plugin>
</plugins>
</build> -
运行项目
一、点击右边的Maven
二、点击插件下的run,即:tomcat7:run,(右键可选择debug模式)
三、待项目运行完成
四、访问