1. {$tomcat}/conf/tomcat-user.xml 配置
<?xml version="1.0" encoding="UTF-8"?>
<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="admin"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/> <role rolename="manager-gui"/> <role rolename="manager-script"/> <role rolename="manager-jmx"/> <role rolename="manager-status"/> <user username="admin" password="admin" roles="admin,manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/></tomcat-users>
2.添加登录界面 {$tomcat}/conf/Catalina/localhost下新建manager.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context privileged="true" antiResourceLocking="false" docBase="${catalina.home}/webapps/manager"> <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" /> </Context>2.{$maven}/conf/settings.xml,在132行之后添加server
<server>
<id>tomcat</id> <username>admin</username> <password>admin</password> </server>id要记住,在pom.xml中需要
3.pom.xml添加
test1 org.codehaus.mojo tomcat-maven-plugin 1.1 http://127.0.0.1:8080/manager/text tomcat admin admin true /test1 org.apache.maven.plugins maven-war-plugin 2.4 /web war