1)修改tomcat的配置(tomcat-users.xml)
<role rolename="manager-gui"/> <role rolename="manager-script"/> <user username="admin" password="password" roles="managergui, manager-script"/> |
2) 配置.m2/setting.xml,添加servers内容
<server> <id>tomcat7</id> <username>admin</username> <password>password</password> </server> |
3)配置pom中的Plugin
<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>tomcat7</server> <path>/demo</path> </configuration> </plugin> |
4)允许mvn命令
mvn clean install tomcat7:deploy mvn clean install tomcat7:redeploy mvn clean install tomcat7:undeploy |
时间: 2024-10-20 07:00:17