Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SpringBoot 2 debug using the Gradle plugin

I am trying to remote debug a Spring Boot 2.0 web application, built and run with the new Spring Boot Gradle plugin. I've read that the way to go is to pass the --debug-jvm option like so:

./gradlew bootRun --debug-jvm

But I get the following:

Problem configuring task :bootRun from command line.
> Unknown command-line option '--debug-jvm'.

Has something changed in Spring Boot 2.0 or am I missing something? The new gradle plugin reference does not mention anything regarding debug.

I am running Spring Boot and spring-boot-gradle-plugin version 2.0.0.M6, gradle version 4.3.1.

like image 454
yannisf Avatar asked May 17 '26 18:05

yannisf


1 Answers

The following would work:

  1. Edit build.gradle bootRun { jvmArgs = ["-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n"] }
  2. Execute./gradlew bootRun
  3. Attach the debugger after the Spring Boot application has started (port 8000 in the specific case)
like image 128
yannisf Avatar answered May 20 '26 07:05

yannisf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!