springboot项目打成jar包如何远程debugg
时间:2020-04-09 12:49:30
收藏:0
阅读:161
1、在项目里加
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9003
</jvmArguments>
</configuration>
</plugin>
2、启动命令:
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9003 -jar aimlbot-0.0.1-SNAPSHOT.jar
启动报错:Debugger failed to attach: handshake failed - connection prematurally closed
说明端口占用,换一个
3、在eclipse里
右键项目 Debug As -> Debug Configuretion -> Remote Java Application ->add ,配置ip,远程端口
注意添加source,比如你想debug依赖的项目,需要在sourece里把依赖的项目比如aiml加上。另外就是注意打包时依赖项目及时install否则运行代码和本地代码不一致,影响debug。
连接好后出现图标说明连好。就可以开始访问,debug了
没有debug连接时是访问不到的。点它断开连接
评论(0)