IDEA远程调试

IDEA远程调试

打包:

生成rebel-remote.xml

安装 Jrebel

https://www.jrebel.com/products/jrebel/download

https://manuals.jrebel.com/jrebel/standalone/install.html

add server

File | Settings | JRebel & XRebel | JRebel Remote Servers

start up

  • java -jar

    java "-agentpath:[JRebel root folder]/lib/libjrebel64.so" -Drebel.remoting_plugin=true -jar myapp-boot.jar

  • mvn

    mvn spring-boot:run -Dspring-boot.run.jvmArguments="-agentpath:[JRebel root folder]/lib/libjrebel64.so -Drebel.remoting_plugin=true"

    File | Settings | JRebel & XRebel | JRebel Startup (Run on a remote server or VM)

springboot

对于 springboot 的程序,在启动命令添加-agentlib参数

1
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar test.jar

注意,该参数必须在 java 命令之后,-jar 参数之前

tomcat

对于部署到 tomcat 上的程序,需要在 catalina.sh 中添加以下代码

1
export JAVA_OPTS='-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005'

集合版

1
java "-agentpath:/opt/jrebel/lib/libjrebel64.so" -Drebel.remoting_plugin=true -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar oa.jar

开始调试

点击 debug 连接上服务器项目

img

作者

Heng.Wang

发布于

2020-06-15

更新于

2023-09-20

许可协议

CC BY-NC-SA 4.0

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×