问题
I am adding the GRADLE_OPTS
to system environment variables as:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
I have created the remote debugger from InteliJ IDEA for this socket. I can debug the build.gradle
file, but I can't enter into the scripts for example can't see the variable values .
回答1:
Here are the steps to remotely debug gradle:
Step-by-step guide
1. Run your Gradle command
2. On the command line, execute your task normally, but add the following additional parameters:
-Dorg.gradle.jvmargs='-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=5005,suspend=y'
The "suspend=y
" part will pause the execution for you to attach a debugger.
Attach a debugger:
- Open the Gradle source code in IntelliJ
- Go to Run -> Edit Configurations
- Add a new Configuration by clicking the + in the upper left corner
- Select Remote, rename it if you choose, and click OK
- Set your breakpoints
- Go to Run -> Debug "" (defaults to "Unnamed")
来源:https://stackoverflow.com/questions/37702073/gradle-remote-debugging-process