maven 自動部署war(項目)到tomcat
1.軟件版本
apache-tomcat-7.0.55
apache-maven-3.2.2
eclipse-standard-luna-R-win32-x86_64
2.修改文件
2.1 tomcat tomcat-users.xml
增加如下用戶 角色 manager-script
-
manager-script — Access to the tools-friendly plain text interface that is described in this document, and to the "Server Status" page.
<role rolename="manager-script"/> <role rolename="manager-gui"/> <role rolename="admin-gui"/> <user username="admin" password="admin" roles="manager-script"/>
參考文檔
http://127.0.0.1:8080/docs/manager-howto.html#Configuring_Manager_Application_Access
2.2 maven setting.xml
servers 里添加
<server> <id>tomcat7</id> <username>admin</username> <password>admin</password> </server>
2.3 項目 pom.xml
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.0-beta-1</version> <configuration> <url>http://localhost:8080/manager/text</url> <server>tomcat7</server> <username>admin</username> <password>admin</password> </configuration> </plugin>
注:此處的server 里面的tomcat7 要與上2.2maven 配置文件setting.xml 里server id 一致
maven 命令:tomcat7:deploy
如下圖
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!