tags:
- maven
- jetty
- idea
- jrebel
- java
Maven + Jetty + IDEA + JRebel enables hot deployment of projects
The development environment
During development: Modifying Java or project files requires reconstructing the project to build deploy, which takes an unbearably long time
How to implement hot deployment of all subsequent changes after one deployment?
- Implemented using JRebel
- The Web container uses Jetty
- Maven for project management
- The IDE uses IDEA
Implementation steps
- Go to Settings > Plugins in idea and search for JRebel –> Browse Repositories
- After the download is complete, apply the idea and restart it
- Because equal is charging software Break the link is as follows: http://blog.lanyus.com/archives/317.html after normal boot styles:
- For the project that needs hot deployment do the following right click on the project name and select JRebel to generate a profile. The correct profile should look like this:
<? xml version="1.0" encoding="UTF-8"? > <! -- This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloadingfor this project.
Refer to https://manuals.zeroturnaround.com/jrebel/standalone/config.html for more information.
-->
<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_1.xsd">
<classpath>
<dir name="C:/workspaces***************/target/classes"> <! -- Compile path for the project --> </dir> </classpath> <web> <link target="/">
<dir name="C:/workspace**********src/main/webapp"> <! -- For the project path --> </dir> </link> </web> </application>Copy the code
- On the menu bar of IDEA, select View > Tool to display both toolbars as follows:
<plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> < version > 8.1.16. V20140903 < / version > < configuration > < stopKey > stop < / stopKey > < stopPort > 9999 < / stopPort > <scanIntervalSeconds>0</scanIntervalSeconds><! -- Use jetty's own hot deployment: 1 does not have to be 0--> <contextXml>${project.basedir}/src/main/resources/jetty-context.xml</contextXml>
<webApp>
<contextPath>/</contextPath>
</webApp>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>8001</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
</configuration>
</plugin>
Copy the code
-
When jRebel Debug is clicked and the launch log appears as shown below, the configuration is successful
-
Hot deployment for a single file: CTRL + Shift + F9 Hot deployment for all modified files: CTRL + F9 Don’t forget CTRL + S before executing
-
If the following information is displayed after the preceding command is executed, the deployment is successful:
Please do not reprint without author’s permission, thank you 🙂