1.软件版本:apache-tomcat-8.0.37
apache-maven-3.3.9
2.配置 apache-tomcat-8.0.37\conf\tomcat-users.xml
文件
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="root" password="root" roles="manager-gui,manager-script"/>
</tomcat-users>
3.配置 pom.xml 文件
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<username>root</username> <!-- tomcat 用户名 -->
<password>root</password> <!-- tomcat 密码 -->
<path>/web</path><!-- 项目名 -->
</configuration>
</plugin>
</plugins>
</build>
4.执行:tomcat7:redeploy