本篇文章給大家分享的是有關(guān)怎么在IDEA中使用maven實(shí)現(xiàn)tomcat熱部署,小編覺得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。
創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于網(wǎng)站制作、成都做網(wǎng)站、萬安網(wǎng)絡(luò)推廣、微信小程序、萬安網(wǎng)絡(luò)營銷、萬安企業(yè)策劃、萬安品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們最大的嘉獎;創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供萬安建站搭建服務(wù),24小時服務(wù)熱線:18980820575,官方網(wǎng)址:aaarwkj.com
在tomcat的conf目錄 tomcat-users.xml配置以下內(nèi)容(<tomcat-users>標(biāo)簽內(nèi)</tomcat-users>),用于部署:
<role rolename="manager"/> <role rolename="manager-gui"/> <role rolename="admin"/> <role rolename="admin-gui"/> <role rolename="manager-script"/> <user username="tomcat" password="tomcat" roles="admin-gui,admin,manager-gui,manager,manager-script"/
啟動tomcat,訪問 http:ip:8080/manager 驗(yàn)證tomcat用戶是否配置成功
在maven工程的pom.xml中配置插件
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <configuration> <port>8080</port> <path>/mvc</path> <url>http://192.168.43.128:8080/manager/text</url> <username>tomcat</username> <password>tomcat</password> </configuration> </plugin>
運(yùn)行配置
點(diǎn)擊Run-->Edit Configurations
點(diǎn)擊+號,選擇Maven ,
輸入信息
Name 給運(yùn)行配置取的名稱
Working directory(工程目錄)
Command line 命令 tomcat7:deploy 或 tomcat7:redeploy
點(diǎn)擊確定,保存。
在Run菜單下找到剛做好的配置,運(yùn)行
[INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for org.jstudioframework:jstudio-mvc:war:1.0-SNAPSHOT [WARNING] 'build.plugins.plugin.version' for org.apache.tomcat.maven:tomcat7-maven-plugin is missing. @ line 91, column 21 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building jstudio-mvc 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> tomcat7-maven-plugin:2.2:redeploy (default-cli) @ jstudio-mvc >>> [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ jstudio-mvc --- [debug] execute contextualize [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 5 resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ jstudio-mvc --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ jstudio-mvc --- [debug] execute contextualize [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory E:\JstudioProject1\JstudioMvc\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ jstudio-mvc --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.14:test (default-test) @ jstudio-mvc --- [INFO] Tests are skipped. [INFO] [INFO] --- maven-war-plugin:2.1.1:war (default-war) @ jstudio-mvc --- [INFO] Packaging webapp [INFO] Assembling webapp [jstudio-mvc] in [E:\JstudioProject1\JstudioMvc\target\jstudio-mvc-1.0-SNAPSHOT] [INFO] Processing war project [INFO] Copying webapp resources [E:\JstudioProject1\JstudioMvc\src\main\webapp] [INFO] Webapp assembled in [177 msecs] [INFO] Building war: E:\JstudioProject1\JstudioMvc\target\jstudio-mvc-1.0-SNAPSHOT.war [WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored (webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true') [INFO] [INFO] <<< tomcat7-maven-plugin:2.2:redeploy (default-cli) @ jstudio-mvc <<< [INFO] [INFO] --- tomcat7-maven-plugin:2.2:redeploy (default-cli) @ jstudio-mvc --- [INFO] Deploying war to http://192.168.43.128:8080/mvc SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Uploading: http://192.168.43.128:8080/manager/text/deploy?path=%2Fmvc&update=true Uploaded: http://192.168.43.128:8080/manager/text/deploy?path=%2Fmvc&update=true (7445 KB at 7083.3 KB/sec) [INFO] tomcatManager status code:200, ReasonPhrase:OK [INFO] OK - Deployed application at context path /mvc [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 14.720s [INFO] Finished at: Sun Jul 23 19:35:01 CST 2017 [INFO] Final Memory: 15M/322M [INFO] ------------------------------------------------------------------------ Process finished with exit code 0
發(fā)布成功。
在tomcat的manager可以看到新發(fā)布的應(yīng)用。
方法2:
以上就是怎么在IDEA中使用maven實(shí)現(xiàn)tomcat熱部署,小編相信有部分知識點(diǎn)可能是我們?nèi)粘9ぷ鲿姷交蛴玫降摹OM隳芡ㄟ^這篇文章學(xué)到更多知識。更多詳情敬請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
網(wǎng)站欄目:怎么在IDEA中使用maven實(shí)現(xiàn)tomcat熱部署
網(wǎng)頁地址:http://aaarwkj.com/article8/gdiiip.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供關(guān)鍵詞優(yōu)化、網(wǎng)站維護(hù)、云服務(wù)器、靜態(tài)網(wǎng)站、微信小程序、虛擬主機(jī)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)