gradle starts the springboot project for remote debugging

Original: https://blog.csdn.net/thomaschant/article/details/52669516

The remote debugging of gradle+springboot+idea project is divided into the following 2 steps

1 First, use gradle to start the springboot project on the server (for example: 100.10.100.200). When starting, you need to set the startup jvm parameters. There are two ways

   Method 1: Add the jvmArgs property to the bootRun task of build.gradle

build.gradle:

bootRun {
    jvmArgs "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
}

   Method 2 Start directly from the command line

 $ gradle bootRun --debug-jvm

 If configured correctly, the following logs are printed during startup,

 Listening for transport dt_socket at address: 5005

At this point, the second step is to configure it locally

2 Configure the IDEA debugging environment locally

   1 In the project startup location in the upper right corner of the idea, select edit configurations, and configure in the pop-up window. Where HOST represents the server-side IP address of the running project, and PORT is the address specified in jvmArgs in the first step. If it is started through the command line, the default is 5005. After the configuration is complete, click apply, and then click OK.

   2 Start the debug mode. If the words Connected to the target VM, address: 'XX.XX.XXX.XXX:XX', transport: 'socket' appear, it means that the local server has started to monitor the server-side program.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324845696&siteId=291194637