IntelliJ IDEA with JRebel

环境

IntelliJ-IDEA 2017.1 JRabel IntelliJ-IDEA plugin 7.0.7 JDK8

IntelliJ IDEA 中 使用JRebel plugin

  • jreble 注册账号, 根据提示得到License code
  • 在 IntelliJ IDEA 安装 JRebel plugin, 用上面的license code激活
  • 在 IntelliJ IDEA settings 里面找到 compiler , enable “Buld project automatically” 和 “Compile independent modules in parallel”
  • 新建一个普通的maven java web工程 demo
  • 在IntelliJ IDEA Run/Debug configurations 里面新建一个local tomcat
    • 在 Server 面板 On ‘Update’ action 选择 “Update classes and resources”
    • 在 Server 面板 On frame deactivation 选择”Update classes and resources”
    • 在 Deployment 面板 选择 demo:war exploded
    • 如果出现java.lang.OutOfMemoryError: PermGen space , 在Runner面板 VM Options 添加 jvm参数 -server -XX:PermSize=256M -XX:MaxPermSize=512m -Dfile.encoding=UTF-8
  • 在JRebel Panel enable JRebel(会在maven 工程的resources目录生成rebel.xml)
  • 然后选择 JRebel debug启动就会看到下面日志,表示JRebel成功
    2017-04-21 18:13:44 JRebel: Contacting myJRebel server ..
    2017-04-21 18:13:47 JRebel:  Starting logging to file: C:\Users\DJH\.jrebel\jrebel.log
    2017-04-21 18:13:47 JRebel:
    2017-04-21 18:13:47 JRebel:  #############################################################
    2017-04-21 18:13:47 JRebel:
    2017-04-21 18:13:47 JRebel:  JRebel Agent 7.0.7 (201704100855)
    2017-04-21 18:13:47 JRebel:  (c) Copyright ZeroTurnaround AS, Estonia, Tartu.
    2017-04-21 18:13:47 JRebel:
    2017-04-21 18:13:47 JRebel:  Over the last 2 days JRebel prevented
    2017-04-21 18:13:47 JRebel:  at least 17 redeploys/restarts saving you about 0.7 hours.
    2017-04-21 18:13:47 JRebel:
    2017-04-21 18:13:47 JRebel:  Licensed to wzhonggo go (using myJRebel).
    2017-04-21 18:13:47 JRebel:
    2017-04-21 18:13:47 JRebel:
    2017-04-21 18:13:47 JRebel:  #############################################################
    2017-04-21 18:13:47 JRebel:
    
  • 随便修改一个java 文件, 会到console 日志里面看到 下面日志
    2017-04-21 18:15:31 JRebel: Reloading class 'com.demo.UserController'.
    2017-04-21 18:15:32 JRebel: Reinitialized class 'com.demo.UserController$$EnhancerBySpringCGLIB$$45800121'.
    
  • 如果使用的是 tomcat7-maven-plugin 或者是jetty-maven-plugin 来启动 web项目, 在修改java文件后,需要手动Recompile修改过的文件(Ctrl+Shift+F9), 然后也会看到上面JRebel reloading修改过的文件的日志,
    • 如果使用jetty-maven-plugin, 手动Recompile 导致整个应用重启, 需要关掉自动热部署 ```xml
manual

```

参考文档
最近的文章

Jenkins git polling log error with code 128

环境 Jenkins 1.x ,2.x git 2.11git远程仓库有新的commit ,但是jenkins不能触发自动编译, 但是手动点击编译是可以的 git 仓库配置是https协议的,用户名和密码直接写带url上面 jenkins git Poll SCM 配置 H H/1 * * * Git Polling Log git.exe -c core.askpass=true ls-remote -h https://useranme@bitbucket...…

继续阅读
更早的文章

eclipse information center

环境Eclipse NeonJDK8搭建 eclipse help server 下载Eclipse Neon 安装Neon 在 D:\test 目录, 会创建 D:\test\eclipse目录, 在D:\test\eclipse\plugins 目录查看 eclipse help base jar 的版本,然后替换下面version, 在cmd窗口里面运行下面命令 java -classpath D:\test\eclipse\plugins\org.eclipse....…

继续阅读