在pom.xml中加入如下配置:
<build>
<finalName>showtime-manager-web</finalName>
<plugins>
<!-- 配置Tomcat插件 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<!--配置为/当访问localhost时不需要再加8081-->
<path>/</path>
<port>8081</port>
</configuration>
</plugin>
</plugins>
</build>
选择Edit Configuration

接着点击左上角的+,选择maven

输入相关信息,点击Apply之后,点击OK

效果如图:

在web.xml文件中加入以下内容:
<web-app>
<display-name>showtime-manager-web</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
点击途中三角形的图标启动项目

访问效果如下图:


本文介绍了如何在pom.xml中配置Tomcat Plugin,通过编辑Maven配置来启动Java Web项目。首先,在pom.xml中添加相关配置,然后在IDE中选择Edit Configuration,新增Maven构建。接着输入必要的Maven信息并保存。在web.xml中添加启动配置后,通过IDE的三角形图标启动项目,最后展示了项目成功运行的访问效果。
195

被折叠的 条评论
为什么被折叠?



