1. 用tomcat插件(常用)
在网站 https://mvnrepository.com/ 内搜索所需的内容,搜索tomcat
将如下代码复制到pom.xml文件的built下配置
<!-- 导入tomcat插件-->
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>8088</port>
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>
如果没有显示插件,把built内其他所有内容去掉
如图点击tomcat7:run-war运行,若显示项目网址则成功。
2. 本地配置tomcat Server
打开Run下的Edit Configurations
选择Tomcat Server下的local
命名和选择即可