參考文章:
maven tomcat plugin實現熱部署:http://www.zmynmublwnt.cn/article/163052.html
實現maven項目部署到服務器分為如下幾個步驟:
- tomcat 的tomcat-users.xml中添加用戶;
- maven 的settings.xml中添加server;
- pom.xml中添加tomcat7-maven-plugin插件配置;
- 在tomcat運行的情況下,運行 tomcat7:deploy 命令。
1、添加用戶
在 標簽內:
1
2
3
4
5
6
7
8
|
<role rolename= "admin" /> <role rolename= "admin-gui" /> <role rolename= "manager" /> <role rolename= "manager-script" /> <role rolename= "manager-gui" /> <role rolename= "manager-jmx" /> <role rolename= "manager-status" /> <user username= "admin" password= "admin" roles= "admin,manager,manager-gui,admin-gui,manager-script,manager-jmx,manager-status" /> |
2、添加server
在 標簽內:
1
2
3
4
5
|
<server> <id>tomcat- 8.0 . 29 </id> <username>admin</username> <password>admin</password> </server> |
3、添加插件配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
<!-- maven tomcat plugin --> <plugin> <groupid>org.apache.tomcat.maven</groupid> <artifactid>tomcat7-maven-plugin</artifactid> <version> 2.2 </version> <configuration> <!--deploy to server--> <url>http: //localhost:8080/manager/text</url> <server>tomcat- 8.0 . 29 </server> <username>admin</username> <password>admin</password> <path>/crowfunding</path> <port> 8080 </port> </configuration> </plugin> |
4、運行 tomcat7:deploy
注:tomcat為運行狀態方起作用,否則部署失敗。
總結
以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,謝謝大家對服務器之家的支持。如果你想了解更多相關內容請查看下面相關鏈接
原文鏈接:https://blog.csdn.net/u012099869/article/details/50449551