简体   繁体   中英

How can I debug gradle plugin

I have written an andrioid gradle plugin with IntelliJ.And I used it in an Android application.I would like to debug the plugin.So I tried to create a remote debug in IntelliJ 在此输入图像描述

Then do something in Android Studio. Excute
export GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" and ./gradlew showTips --no-daemon .The result is the IJ debugger can connect to VM,but did not STOP at the breakpoint. My plugin code is this 在此输入图像描述

The resule in IJ is this ,and never stop at the breakpoint

Connected to the target VM, address: 'localhost:5005', transport: 'socket'
Disconnected from the target VM, address: 'localhost:5005', transport: 'socket'

What can I do to make the breakpoint to be useful

I think you also need to set a debug property for gradle. -Dorg.gradle.debug=true

org.gradle.debug
    When set to true, Gradle will run the build with remote debugging enabled,
    listening on port 5005. Note that this is the equivalent of adding
    -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
    to the JVM command line and will suspend the virtual machine until a
    debugger is attached.

https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM