一、给 tomcat 添加用户名、密码
在安装目录/cong/tomcat-user.xml中添加以下配置
<role rolename="manager-gui" />
<role rolename="manager-script" />
<user username="tomcat7" password="tomcat7" roles="manager-gui, manager-script" />
二、在 maven 项目中添加 tomcat 插件
1. 在 pom.xml 中添加插件和依赖
<plugin>
<groupId>org.apache.tomcat.mavengroupId>
<artifactId>tomcat7-maven-pluginartifactId>
<version>2.2version>
<configuration>
<url>http://localhost:8080/manager/texturl>
<path>/path>
<server>tomcat8server>
<username>tomcatusername>
<password>tomcatpassword>
configuration>
plugin>
<dependency>
<groupId>org.apache.tomcatgroupId>
<artifactId>tomcat-servlet-apiartifactId>
<version>8.5.4version>
dependency>
三、startup.bat 启动服务器 再右击项目>run as>maven build...
注:tomcat6插件名前为tomcat6 7/8为tomcat7