使用Maven插件启动tomcat服务

新建maven web项目,首先保证maven环境OK,maven项目能正常install
1、pom.xml文件配置如下:

	<build>
		<pluginManagement>
			<plugins>
				<!-- 配置Tomcat插件 -->
				<plugin>
					<groupId>org.apache.tomcat.maven</groupId>
					<artifactId>tomcat7-maven-plugin</artifactId>
					<version>2.2</version>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.apache.tomcat.maven</groupId>
				<artifactId>tomcat7-maven-plugin</artifactId>
				<configuration>
					<port>80</port>
					<path>/</path>
				</configuration>
			</plugin>
		</plugins>
	</build>

2、eclipse工具中,使用Run as ->Maven Build->在goals中输入 tomcat7:run即可

原文地址:https://www.cnblogs.com/wuhaidong/p/10193335.html