本文将介绍常用的编译器eclipse和idea中maven项目集成tomcat的方式
- eclipse
- 添加tomcat插件(注意添加的tomcat创建在idea和eclipse中都一样)
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
//也可以改为6或者直接写tomcat,那下面写maven命令时要与这里对应
<version>2.2</version>
<configuration>
<port>80</port> //可以自行制定端口号
<!-- <path>/abc</path> -->
<uriEncoding>UTF-8</uriEncoding>
</configuration>
</plugin>
- idea中只需要在
- eclipse中只需要配置,run Configuration
- new 新建maven指令
- 指定工作目录
- 在Goals中输入指令
2.idea
添加的tomcat插件是一样的
出现如下界面
点击后出现