1、在pom中添加 tomcat的插件
在tomcat的官网可以查看到tomcat插件的配置信息。
添加插件信息到pom中
<build>
<finalName>p2.customer</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<span style="white-space:pre"> </span><port>9090</port>
<span style="white-space:pre"> </span><path>/</path>
<span style="white-space:pre"> </span><uriEncoding>UTF-8</uriEncoding>
<span style="white-space:pre"> </span><finalName>p2</finalName>
<span style="white-space:pre"> </span><server>tomcat7</server>
<span style="white-space:pre"> </span></configuration>
</plugin>
</plugins>
</build>
2、配置maven的tomcat启动
在base directory中根据 browse file system选择项目所在的路径、在goals中输入tomcat7:run
3、点击Run
等待更新本地的maven库,如果本地有所需要的包就会很快。