# Debugging Gradle tasks from Eclipse with one click: a plugin built on Buildship

**URL:** <https://discuss.gradle.org/t/debugging-gradle-tasks-from-eclipse-with-one-click-a-plugin-built-on-buildship/52256>\
**Category:** Buildship\
**Created:** [October 20, 2026, 11:02pm UTC](https://discuss.gradle.org/t/debugging-gradle-tasks-from-eclipse-with-one-click-a-plugin-built-on-buildship/52256 "2026-10-20T23:02:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![legrottaglie.gionata](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/legrottaglie.gionata/32/12173_2.png) [@legrottaglie.gionata](https://discuss.gradle.org/u/legrottaglie.gionata)\
**Post date:** [October 20, 2026, 11:02pm UTC](https://discuss.gradle.org/t/debugging-gradle-tasks-from-eclipse-with-one-click-a-plugin-built-on-buildship/52256/1 "2026-10-20T23:02:08Z")

</div>

In [this 2016 thread](https://discuss.gradle.org/t/gradle-buildship-plugin-with-eclipse-hard-time-finding-debug-option/15325), debugging Gradle tasks from Buildship was on the roadmap; the workaround is still `--debug-jvm` plus a _Remote Java Application_ in Eclipse. I wrote an open-source plugin that does it in one click, and I would like feedback from Buildship users and maintainers.

**What it does.** It adds _Debug Gradle Tasks_ to the context menu of the Gradle Tasks view and a debug mode to _Gradle Task_ run configurations. Every JVM the build forks (`JavaExec`, `Test`, `bootRun`, …) is attached to the Eclipse debugger.

**How it works.**

- Eclipse listens with JDT’s Socket Listen connector on a free port.
- An init script, added through Buildship’s `invocationcustomizers` extension point, sets `debugOptions` on every `JavaForkOptions` task: `server=false`, `suspend=true`, the port read lazily from a system property, so the configuration cache is reused across debug sessions.
- During the session, a saved Java file is compiled by Gradle (`classes`) and the class files it rewrote go to JDT’s hot code replace. Classes compiled by ECJ cannot replace classes compiled by javac: their lambda methods have different names.

**Two questions for the Buildship team.**

1. Reading the selection of the Gradle Tasks view needs Buildship’s internal node classes, which `org.eclipse.buildship.ui` does not export. Would a small public API for the selected tasks be welcome?
2. Buildship runs builds inside `IWorkspace.run`, which holds back Eclipse’s auto-build until a long-running task such as `bootRun` ends. Is that intended for run configurations?

GitHub: [GitHub - legrottagliegionata/eclipse-gradle-debug: Debug any Gradle task from Eclipse's Gradle Tasks view, as in IntelliJ IDEA · GitHub](https://github.com/legrottagliegionata/eclipse-gradle-debug) (EPL 2.0, Eclipse 2024-06 or later, also on the Eclipse Marketplace). Write-up with the details: [Debugging Gradle tasks in Eclipse, the way IntelliJ does it - DEV Community](https://dev.to/gionata_legrottaglie/debugging-gradle-tasks-in-eclipse-the-way-intellij-does-it-1a82)

Disclosure: I am the author of the plugin.

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [October 21, 2026, 7:01am UTC](https://discuss.gradle.org/t/debugging-gradle-tasks-from-eclipse-with-one-click-a-plugin-built-on-buildship/52256/2 "2026-10-21T07:01:22Z")

</div>

With `server=false` the `suspend` option is ignored as far as I’m aware, I’d remove it.

---

<div class="post-metadata">

**Author:** ![legrottaglie.gionata](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/legrottaglie.gionata/32/12173_2.png) [@legrottaglie.gionata](https://discuss.gradle.org/u/legrottaglie.gionata)\
**Post date:** [October 21, 2026, 8:54am UTC](https://discuss.gradle.org/t/debugging-gradle-tasks-from-eclipse-with-one-click-a-plugin-built-on-buildship/52256/3 "2026-10-21T08:54:51Z")

</div>

Thanks for looking at it! I checked, and `suspend` is honored with `server=n` too. The JDWP agent connects to the debugger during JVM startup, and with `suspend=y` the VM start event suspends all threads until the debugger resumes them.

A quick test with `jdb -connect com.sun.jdi.SocketListen:port=…` and a hello-world:

- `server=n,suspend=y`: `main` only ran after I typed `cont` in jdb.

- `server=n,suspend=n``: `main` ran and the JVM exited right after connecting, before the debugger could do anything.

The plugin relies on that. Eclipse installs the breakpoints while the forked JVM is suspended at start, so a breakpoint on the first lines of `main` is still hit. With `suspend=false` that would be a race.

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [October 21, 2026, 12:09pm UTC](https://discuss.gradle.org/t/debugging-gradle-tasks-from-eclipse-with-one-click-a-plugin-built-on-buildship/52256/4 "2026-10-21T12:09:49Z")

</div>

Oh, interesting.  
Wasn’t aware of that.  
What I always observed was, that with `server=n` the JVM startup fails when the debugger is not listening.  
So I assumed that `suspend` is ignored because if it couldn’t connect JVM startup fails and if it was able to connect it continued immediately.  
That there are underlying things done by the debugger first and then threads resumed was never visible to me.

Thanks for telling, TIL.
