I’m working on my first plugin, getting testing and debugging working before I write a lot of code. The plugin and tasks are working skeletons, and a separate project applying the plugin reports the task on “gradle tasks”, so that looks good so far.
I now want to step through the existing plugin code in the debugger. The advice on this seem scattered. The user guide has almost no information about this, and I think I see a discrepancy in what little is there. The only statement in the entire user guide that mentions debugger support is the following section:
23.13.2. Debugging > The test task provides a Test.getDebug() property that can be set to launch to make the JVM wait for a > debugger to attach to port 5005 before proceeding with test execution. > This can also be enabled at invocation time via the --debug-jvm task option (since Gradle 1.12).
When I run Gradle 2.3 with “–debug-jvm”, it says: “Unknown command-line option ‘–debug-jvm’.”
I also found a Gradle forum post that Peter responded to. I’m using that as a guide, but I’m still seeing weird results with no success.
I first turned off the daemon in ~/.gradle/gradle.properties and then killed the daemon process.
I set a breakpoint in my plugin’s “apply” method. I know it’s getting here because I just added a line that fixes a bug, and after installing the plugin the project using it doesn’t get the error anymore.
In my shell, I set GRADLE_OPTS to:
"-Dhttp.proxyHost=myproxyhost -Dhttp.proxyPort=myproxyport -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006"
I then ran the following, with the following output:
% gradle tasks --no-daemon -Dorg.gradle.debug=true
Listening for transport dt_socket at address: 5006
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: http://gradle.org/docs/2.3/userguide/gradle_daemon.html.
The statement about forking the JVM is curious.
I then connected to 5006 from Eclipse.
At this point both Gradle and Eclipse are contentedly waiting for something to happen.
What can I do here?