maven+tomcat热部署

1.首先修改tomcat安装目录下的conf文件夹中的tomcat-user.xml文件
  <role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <user username="tomcat" password="tomcat" roles="manager-gui,manager-script"/>

2.重启tomcat后,在tomcat首页点击manager,输入上面配置的用户名密码后,进入到如下页面,表示配置的没有问题。

 

3.  pom文件中添加如下插件

<plugin>
  <groupId>org.apache.tomcat.maven</groupId>
  <artifactId>tomcat7-maven-plugin</artifactId>
  <version>2.2</version>
  <configuration>
  <port>8181</port>
  <path>/appName</path>
  <url>http://ip:端口/manager/text</url>
  <username>tomcat</username>
  <password>tomcat</password>
  </configuration>
</plugin>

 

4.使用maven命令进行部署。
tomcat7:deploy(第一次)
tomcat7:redeploy(重新部署)
部署工程跳过测试:clean tomcat7:redeploy -DskipTests

热部署成功

 

posted @ 2018-12-03 11:14  老衲洗头爱飘柔  阅读(250)  评论(1编辑  收藏  举报