maven中提供了tomcat7-maven-plugin插件,可以不用配置本地tomcat服务器。
1、在pom中添加配置

1 <build> 2 <!-- 本地tomcat7插件 --> 3 <plugin> 4 <groupId>org.apache.tomcat.maven</groupId> 5 <artifactId>tomcat7-maven-plugin</artifactId> 6 <version>2.1</version> 7 <configuration> 8 <path>/</path> 9 <uriEncoding>UTF-8</uriEncoding> 10 <port>8888</port> 11 </configuration> 12 </plugin> 13 </plugins> 14 </build>
2、设置maven命令行
点击工具栏run->edit configurations,出现如下窗口;输入tomcat7:run