Win七、JDK1.八、maven+jetty插件、SpringMVC、Intellij IDEA 2018.1.2html
在線安裝:web
Settings --> Plugins --> Browse repositories... -->搜索欄搜索:JRebel --> 點擊 Install 按鈕 安裝app
離線安裝:eclipse
一、從官網下載 https://zeroturnaround.com/software/jrebel/download/#!/have-license/intellij webapp
二、Settings --> Plugins --> Install plugin from disk...maven
ps:安裝完畢後重啓IDEAspa
上官網 https://zeroturnaround.com/software/jrebel/trial/ 註冊一個號,而後就能夠獲取到激活碼。在help->JRebel->Activation中激活JRebel.net
1)pom.xml文件配置jetty容器和JRebel插件。插件
PS:webdefault.xml文件定位於:${mvn_repro}/org/eclipse/jetty/jetty-webapp/{version}/jetty-webapp-{version}.jar,將jar解壓,找到webdefault.xml複製到項目的resource目錄中,修改參數便可。3d
<!--jetty插件-->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.10.v20150310</version>
<configuration>
<!--熱部署掃描時間,這裏值設置爲0表示熱部署掃描由Rebel完成-->
<scanIntervalSeconds>0</scanIntervalSeconds>
<webAppSourceDirectory>${project.basedir}/src/main/webapp</webAppSourceDirectory>
<httpConnector>
<!--啓動端口-->
<port>9999</port>
</httpConnector>
<stopKey>sk</stopKey>
<stopPort>9998</stopPort>
<scanIntervalSeconds>5</scanIntervalSeconds>
<webApp>
<contextPath>/</contextPath>
<!--
解決jetty熱部署不能修改靜態資源的問題,
將webdefault.xml拷貝到src/main/resources/目錄中,並修改useFileMappedBuffer參數,把值設成false
-->
<defaultsDescriptor>src/main/resources/webdefault.xml</defaultsDescriptor>
</webApp>
<!--jetty:run指定加載classes路徑,配置了filters,這裏就不配置了
<classesDirectory>target/${artifactId}/WEB-INF/classes</classesDirectory>-->
</configuration>
</plugin>
2)將工程託管給JRebel
打開view --> Tool Windows --> JRebel
3)配置Maven jetty 啓動項
4)Maven + Jetty + JRebel 已經配置完成,咱們啓動一下JRebel試試看
5)修改代碼後
ps:若是修改代碼後沒有效果,記得要Ctrl + Shift + F9(刷新當前的文件)或者Ctrl + F9(刷新整個項目)