debug-surefire

Run Maven Surefire tests in JDWP wait-for-debugger mode with a suspendable port.

409|186|Updated Jan 14, 2016
One-click install
npx skills add https://github.com/eclipse-rdf4j/rdf4j --skill debug-surefire
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: debug-surefire
Source: https://github.com/eclipse-rdf4j/rdf4j/tree/main/.codex/skills/debug-surefire
Command: npx skills add https://github.com/eclipse-rdf4j/rdf4j --skill debug-surefire

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Debugging Maven Surefire unit tests can be painful when tests run in forked JVMs. This Skill provides a workflow to run tests in JDWP wait-for-debugger mode and attach a debugger easily.

Core Features & Use Cases

  • Launch Surefire in JDWP suspend mode to pause until a debugger attaches.
  • Attach with jdb or IDE debuggers to a forked test JVM for step-through debugging.
  • Supports running a specific test class or test method and multi-module projects.

Quick Start

Invoke the skill to start a suspended test run for a class, and attach your debugger to the printed port.

Frequently Asked Questions about debug-surefire

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug Maven Surefire tests running in a forked JVM?▼

To debug Maven Surefire tests in a forked JVM, you launch Surefire in JDWP suspend mode to pause execution and attach a debugger to the exposed localhost port. This allows step-through debugging of your test classes or methods.

Can I attach jdb to a Maven test running in wait-for-debugger mode?▼

Yes, you can attach jdb to a Maven test running in wait-for-debugger mode. The process launches Surefire with JDWP enabled, prints the transport address, and suspends the forked test JVM until your jdb or IDE debugger connects.

How do I debug a specific test method in a multi-module Maven project?▼

You can debug a specific test method in a multi-module Maven project by targeting the test class or method when invoking the skill. It runs the specified test in JDWP suspend mode, allowing a debugger to attach to the forked test JVM.

What does it mean to run Surefire with JDWP suspend mode?▼

Running Surefire with JDWP suspend mode means the forked test JVM starts but pauses execution immediately, waiting for a debugger to attach to a designated localhost port before proceeding with the test run.

Does this approach work with IDE debuggers or only jdb?▼

This approach works with both jdb and IDE debuggers. Once Surefire launches in JDWP suspend mode and prints the transport address, you can attach any debugger that supports connecting to a localhost port.

Why does my Maven test execution hang when debugging is enabled?▼

Your Maven test execution hangs because the forked test JVM is suspended in JDWP wait-for-debugger mode. It is waiting for a debugger to attach to the printed localhost port before it proceeds with running the Surefire tests.