Maven Jrebel 多模块热部署方案
生活随笔
收集整理的這篇文章主要介紹了
Maven Jrebel 多模块热部署方案
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
近期在構(gòu)建maven多模塊項目時,發(fā)現(xiàn)web module依賴的其它模塊,每次都要clean install成一個jar包,然后運行web module才能加載。
本生jrebel是配置在了web module主模塊上,只要修改的是web模塊里面的java文件都會自動reloading加載。
這個問題正在尋找解決辦法。時刻會更新到這里,如果有誰有解決辦法可以幫幫忙。
更新,經(jīng)過多重測試,在web模塊pom中增加紅色字體部分,就ok了。啟動的時候,會直接編譯依賴模塊的target/classes,就直接忽略了clean install產(chǎn)生的jar,
再有就是在修改依賴module項目java類的時候,jrebel會自動reloading class
2015-03-25 00:48:46 JRebel: Reloading class 'com.xx.api.data.user.service.UserProfileService'.
提示上面一句話就證明ok拉。下面是我web模塊的部分配置。請參考,也可以聯(lián)系我的微信:benyzhous
<plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.3.2</version><configuration><source>1.7</source><target>1.7</target></configuration></plugin><!-- 配置 maven 的 jetty 插件 --><plugin><groupId>org.mortbay.jetty</groupId><artifactId>jetty-maven-plugin</artifactId><version>7.2.2.v20101205</version><configuration><webAppConfig><contextPath> /${project.artifactId}</contextPath><!-- 指定 root context 在這里指定為${project.artifactId} 即 jetty, 那么訪問時就用http://localized:8080/jetty 訪問, 如果指定梶為test 就用http://localized:8080/test訪問,更多信息,請查看jetty 插件官方文檔 --><span style="color:#ff0000;"><!-- 設(shè)置其他項目extraClasspath,多個用";"隔開 --><extraClasspath>../data-service/target/classes;</extraClasspath> </span></webAppConfig><scanTargets><!-- <scanTarget>../data-service/target/classes</scanTarget> --></scanTargets><!-- 指定額外需要監(jiān)控變化的文件或文件夾,主要用于熱部署中的識別文件更新 --><scanTargetPatterns><scanTargetPattern><directory>src</directory><includes><include>**/*.java</include><include>**/*.properties</include></includes><!-- <excludes> <exclude>**/*.xml</exclude> <exclude>**/myspecial.properties</exclude> </excludes> --></scanTargetPattern></scanTargetPatterns><scanIntervalSeconds>0</scanIntervalSeconds><!-- 指定監(jiān)控的掃描時間間隔,0為關(guān)閉jetty自身的熱部署,主要是為了使用jrebel --><webAppSourceDirectory>${basedir}/src/main/webapp</webAppSourceDirectory><!-- 指定web頁面的文件夾 --></configuration></plugin><!-- jerebel maven 插件,用于生成jrebel.xml --><plugin><groupId>org.zeroturnaround</groupId><artifactId>jrebel-maven-plugin</artifactId><version>1.1.5</version><executions><execution><id>generate-rebel-xml</id><phase>process-resources</phase><goals><goal>generate</goal></goals></execution></executions><configuration><rebelXmlDirectory>${basedir}/src/main/webapp/WEB-INF/classes</rebelXmlDirectory><!-- 指定生成的jrebel.xml放在哪里, 要求放在web應(yīng)用的 classpath下 --></configuration></plugin></plugins><outputDirectory>${basedir}/src/main/webapp/WEB-INF/classes</outputDirectory><!-- 指定編譯后文件的存放路徑,因為jetty默認src/main/webapp為 web應(yīng)用的根目錄而 maven compile 目標(biāo)后的默認classpath 在target文件夾下,就造成jrebel.xml無法兼顧 jetty 默認的是webapp中的classes為 web 應(yīng)用的根目錄, 而maven 默認是target 目錄所以需要修改該maven的默認classes目錄。 -->轉(zhuǎn)載于:https://www.cnblogs.com/duyinqiang/p/5696755.html
總結(jié)
以上是生活随笔為你收集整理的Maven Jrebel 多模块热部署方案的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【html 及 HTML5所有标签汇总】
- 下一篇: Python(2.7.6) 列表推导式