IntelliJ Idea中使用JRebel

JRebel是一款热部署插件,内置各种常见框架的热部署支持。

在使用Maven构建时,可以在项目根目录pom.xml添加全局插件即可。

<build>
    <plugins>
        <plugin>
            <groupId>org.zeroturnaround</groupId>
            <artifactId>jrebel-maven-plugin</artifactId>
            <version>1.1.5</version>
            <configuration>
                <addResourcesDirToRebelXml>true</addResourcesDirToRebelXml>
                <alwaysGenerate>true</alwaysGenerate>
                <showGenerated>true</showGenerated>
            </configuration>
            <executions>
                <execution>
                    <id>generate-rebel-xml</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

吐槽一句,JRebel不支持Static块和Static常量的热部署,Static模块一旦访问或修改一次,下一次修改将失效。所以,呵呵,你还是重启服务器吧。另外,JRebel的版本更新比较快,官网上也只发布最新的版本,新的版本有时又不能在旧的IntelliJ插件上使用,毕竟是商用的,所以,不要随便升级。

可以参考到链接:http://zeroturnaround.com/forums/topic/static-initializers-are-not-reloaded/

你可能感兴趣的:(IntelliJ Idea中使用JRebel)