how to debug spring application with gradle

后端 未结 5 558
渐次进展
渐次进展 2020-12-23 16:43

I am working on spring app and need to step through a controller method to see how it works. I am working in eclipse and building my app with gradle bootRun co

5条回答
  •  一生所求
    2020-12-23 17:13

    Define an executes a Java application in a child process.

    task executeApp() {
        doFirst {
           println "Executing java app from Gradle..."
           javaexec {
               main = "com.mymain"
               jvmArgs = ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=30000"]
           }
        }
    }
    

    Set your breakpoints in the java code. After execute the Gradle task.For example in Windows:

      .\gradlew.bat executeApp
    

    The task waits until you attach the debugger. For example in Netbeans go to Debug->Attach debugger , set 30000 on port Field.

提交回复
热议问题