Debug
./gradlew runSingle --debug-jvm -PmainClass=Mai
build.gradle
test {
debugOptions {
enabled = true
port = 4455
server = true
suspend = true
}
}
or
run{
debugOptions {
enabled = true
port = 4455
server = true
suspend = true
}
}
Remote Debugging in Gradle
tasks.withType(JavaExec) {
if (System.getProperty('DEBUG', 'false') == 'true') {
jvmArgs '-Xdebug', '-Xrunjdwp:transport=debug_socket,server=y,suspend=y,address=9099'
}
}
To know what’s happening with the arguments, read this about the arguments that you need to send to jvm to make remote debugging possible:
enable-remote-debugging
Running instructions
Step1:
gradle -DDEBUG=true run
Now in the console you will see something like this:
Listening for transport debug_socket at address: 9099
Step2:
Configuration
->Remote Java Application
- set these fields:
- project
- host (here its localhost)
- port (in this example it will be 9099)