当您希望Maven将Web应用程序(WAR工件)部署到Tomcat 8服务器时,仍然可以使用
tomcat7-maven-plugin。
内
pom.xml
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <url>http://localhost:8080/manager/text</url> <server>tomcat8_vy</server> </configuration></plugin>
在Maven的安装目录里面,看文件
settings.xml,路径是这样的
/apache-maven-3.3.9/conf/settings.xml
<servers> <server> <id>tomcat8_vy</id> <username>tomcat_username</username> <password>tomcat_password</password> </server></servers>
在Tomcat的安装目录内,查找文件
tomcat-users.xml,路径是这样的
/apache-tomcat-8.0.36/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-status"/> <role rolename="manager-script"/> <role rolename="manager-jmx"/> <user username="tomcat_username" password="tomcat_password" roles="manger-gui,manager-status,manager-script,manager-jmx"/></tomcat-users>
转到web-app的目录,其中有
pom.xml,键入命令
mvn tomcat7:deploy
要么
mvn tomcat7:redeploy
进行第二次部署(如果服务器未关闭)。
您可以
deploy从IDE的Maven插件运行/执行。



