buildship
buildship copied to clipboard
Ease of debug via gradle buildship in STS
Hi all,
Currently, in order to do debugging, i have to do the below one-time setup
Add the below to build.gradle
bootRun {
jvmArgs=["-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=32323"]
}
Add a debug configuration for the "Remote Java Configuration" type, with the port field set to 32323
Once above done, to do debug, i need to do the 2 steps Step 1) Via the gradle task pane, double click on bootRun task. This will launch the spring boot application , but it will suspend immediately upon launching.
Step 2) Then run the debug configuration.
The application will now resume from suspend and start running in debug mode, pausing at any breakpoint (if set).
My question is, the above process is so troublesome. Each time i debug, i have to go thru the 2 steps . To improve developer experience, can we have also a debug button for each task displayed in the gradle task pane., so that clicking on the debug button will actually execute the above 2 steps. In fact, the aforementioned setup can even be automated for developer.
This is exactly what the "gradle for java" extension in visual studio code is doing, making life so simple for developer.
Do note that my above discussion focus on how to debug via gradle, not debug via the STS
Do not suggest clicking the debug button on the eclipse (or STS), as that DOES NOT goes thru the gradle. consider this situation, i have defined some system properties in the build.grade to pass to the running application.
if i click the debug button on the eclipse, these system properties defined in the build.gradle will NOT be passed to the running application, as gradle is not involved.
Any response for this? Currently there is a gradle extension for vscode that can do this. It provide GUI for us to run the code in debug mode via gradle. So I thought gradle buildship in STS could achieve the same.
See https://github.com/microsoft/vscode-gradle
Anyone???