<build>
<plugins>
<!-- 配置Tomcat插件 ,用于启动项目 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<!--如果不设置,则默认为猫的自定义端口,项目路径为http://localhost:默认端口/项目名 -->
<configuration>
<!--如果端口号改为8088:那么访问的时候路径的端口就要写成8088 -->
<port>8088</port>
<!-- 如果设置为/,则项目了路径为http://localhost:端口号 /-->
<!-- 如果设置为/lw,则项目了路径为http://localhost:端口号/lw -->
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>
使用此插件后,maven build 时的命令为:tomcat7:run 此时你会发现启动的tomcat版本为7.x.x 而不是默认的6.x.x了