Use Jrebel for Project hot deployment in Eclipse (Maven plug-in version)

Source: Internet
Author: User
Tags aliyun

JRebel Implementing a Project Hot Deployment (Maven plugin version)

Hot Deployment , is to not restart the application during operation, can be directly software upgrades.

During the development process, a hot deployment is the code that changes as the project runs, and the code takes effect without restarting the server.

Tomcat can make a project hot deployment, but It cannot be hot-deployed when adding methods or method name changes to a class, and requires restarting the server , causing Waste a lot of development time waiting for the project to restart , through the JRebel can achieve most of the project code changes can be For hot deployment .

Before installing the Jrebel plug- in, it is recommended that the Maven jar central repository ( the default is foreign, download slower ) into the domestic, It is recommended to set up the central warehouse of Ali.

Maven Central Warehouse replacement steps:

① changing the Maven configuration file

② setting up the Maven configuration file to Eclipse

1. Locate the local maven installation path and open the conf/under the local MAVEN installation path Settings.xml:

2. Add the following image parameters to the <mirrors></mirrors> tab and Save:

<Mirror>    <ID>Alimaven</ID>    <name>Aliyun maven</name>    <URL>http://maven.aliyun.com/nexus/content/groups/public/</URL>    <mirrorof>Central</mirrorof>        </Mirror>

3. Open the eclipse-->window-->preferences and find the User under Maven Settings:

------------------------------------------------- Step End ------------------------------------------ -------------------

Installing the JRebel plugin in Eclipse :

wait for the installation to complete and restart Eclipse when it pops up dialog box Click OK, wait for automatic restart of Eclipse , the plug-in installation is complete.

------------------------------------------------- Step End ------------------------------------------ --------

When I developed the Tomcat that was used to run the project was Maven's tomcat plugin, so I needed to add Maven's Tomcat plugin, through maven 's Tomcat plug-in running projects want to use JRebel need to add Maven of the JRebel plugins.

Maven 's tomcat plugin with JRebel setup steps:

1. in the pom.xml <build></build> tab under the <plugins> Add the tomcat plugin and jrebel plugin to the tag:

Here is the plugin code:

<!--Maven's Tomcat component, running the project through the MAVEN command Tomcat7:run -<plugin>    <groupId>Org.apache.tomcat.maven</groupId>    <Artifactid>Tomcat7-maven-plugin</Artifactid>    <version>2.2</version>    <Configuration>      <Port>8080</Port>      <Path>/irritability</Path>    </Configuration></plugin><!--Jrebel Hot Deployment Plugin -<plugin>    <groupId>Org.zeroturnaround</groupId>    <Artifactid>Jrebel-maven-plugin</Artifactid>    <version>1.1.8</version>    <executions>      <Execution>      <ID>Generate-rebel-xml</ID>      <Phase>Process-resources</Phase>      <Goals>        <goal>Generate</goal>      </Goals>      </Execution>    </executions></plugin>

2. Select the item and right-click -->jrebel-->enable JRebel will be in the project src/main/resources The rebel.xml configuration file is automatically generated in the directory:

3. Select Item Right click -->run as-->maven build ...:

follow the steps in the diagram to set up and click The Run button runs the project:

Running results: If the Jrebel plugin is successful, then Tomcat starts :

When you save your code after you start to rename a method within a project, JRebel automatically detects code changes and recompile the file that changed the code, and the console prints the information:

Use Jrebel for Project hot deployment in Eclipse (Maven plug-in version)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.