pom.xml里面的配置代码
<build> <plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <configuration> <path>/</path> <port>8080</port> </configuration> </plugin> </plugins> </build>
这样我们运行项目的时候就不用在使用本地的tomcat,直接在pom.xml所在的目录下打开命令窗口(shift+目录下右键菜单),执行mvn tomcat:run就可以运行项目。