导入dependency
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
导入plugins
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/</path> <!--虚拟目录-->
<port>8080</port> <!--端口-->
<server>tomcat7</server>
</configuration>
</plugin>
执行命令mvn tomcat7:run
,即可运行!
tomcat7:deploy --部署一个web war包
tomcat7:reload --重新加载web war包
tomcat7:start --启动tomcat
tomcat7:stop --停止tomcat
tomcat7:undeploy–停止一个war包
tomcat7:run 启动嵌入式tomcat ,并运行当前项目