如何在Intellij Idea中的maven web项目使用tomcat插件

1.在pom.xml如下配置

<plugin>
  		  <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat7-maven-plugin</artifactId>
          <version>2.1</version>
          <configuration>
	            <port>8080</port>
	            <server>tomcat7</server>
          </configuration>
</plugin>

2.点击Run 在弹出小框中选择 Edit Configurations
如何在Intellij Idea中的maven web项目使用tomcat插件
3. 在Configurations窗口中的左上角 点击 + 号 ,再选择maven选项 ,然后就可以在右边配置tomcat run的信息,需要配置的有:Name = 项目名 command line = tomcat7:run Working directory = 项目的路径 , 配置完成后,点击右下角的Apply,然后点击OK完成
如何在Intellij Idea中的maven web项目使用tomcat插件
如何在Intellij Idea中的maven web项目使用tomcat插件
4. 配置完成后,在绿色三角形run的旁边的下拉框里就有刚刚配置的项目名称了,上面配置的项目名称是springMvc001,所以这里是springMvc001,选择springMvc001,然后点击绿色三角形执行Run就可以了
如何在Intellij Idea中的maven web项目使用tomcat插件
5.项目成功启动,通过http://localhost:8080/springMvc-001 就可以访问项目了