debug-surefire
БесплатноЗапускает вложенные скриптыНе проверенDebug Maven Surefire unit tests by running them in JDWP "wait for debugger" mode (`-Dmaven.surefire.debug`) and attaching to the forked test JVM using **jdb**…
от eclipse-rdf4j★ 427 звёзд на GitHubОб этом скилле
debug-surefire
Run Maven Surefire tests suspended in JDWP so you can attach a debugger and step through the code.
In headless/agent environments, attach with jdb (the JDK’s command-line debugger).
What this does
- Runs
mvn testwith Surefire in debug mode via-Dmaven.surefire.debug. - Surefire launches the forked test JVM with a JDWP socket and
suspend=y, meaning:- the forked JVM starts,
- prints “Listening for transport dt_socket at address:
”, - then waits until a debugger attaches,
- only then does it begin executing tests.
This is important: you do not attach to the mvn process itself; you attach to the forked JVM running the tests.
Quick start
- Start a suspended test run
- Debug a test class:
.codex/skills/debug-surefire/scripts/debug-surefire.sh --test-class MyTest
- Debug a single test method (quote the
#):.codex/skills/debug-surefire/scripts/debug-surefire.sh --test 'MyTest#shouldDoThing'
- Debug a test in a specific module:
.codex/skills/debug-surefire/scripts/debug-surefire.sh --module core/sail/shacl --test-class ShaclSailTest.codex/skills/debug-surefire/scripts/debug-surefire.sh --module rdf4j-sail-shacl --test 'ShaclSailTest#testSomething'
When the forked JVM is ready, you should see something like:
Listening for transport dt_socket at address: 55005
- Attach with
jdb(preferred)
In a second terminal, attach to the printed port:
- Local attach (port only implies localhost):
jdb -attach 55005
- Explicit host+port:
jdb -attach localhost:55005
If you need source listing inside jdb, provide a sourcepath up front:
jdb -sourcepath module/src/main/java:module/src/test/java -attach 55005
- Set breakpoints / catches, then resume
Once you’re at the jdb prompt, set a breakpoint (or exception catch) and continue:
stop in com.example.MyTest.shouldDoThingcatch uncaught java.lang.AssertionErrorcont
Tip: right after attaching to a just-started suspended JVM, jdb may show:
No frames on the current call stack
That’s normal. The JVM hasn’t executed into any Java frames yet. Set breakpoints first, then cont.
Notes
- The script runs a fast pre-test install (
-Pquickinto the repo-local.m2_repo) and then runsmvn testwith Surefire in debug mode. - Use
SUREFIRE_DEBUG_PORT=8000to change the port (default:55005). - Use
--no-offline/--onlineif offline (-o) resolution fails. - Everything after
--is passed to Maven, e.g.:.codex/skills/debug-surefire/scripts/debug-surefire.sh --test-class MyTest -- -DtrimStackTrace=false -DfailIfNoTests=false -DforkCount=1 -DreuseForks=false
jdb interaction guide
This section is optimized for quickly getting signal from a failing unit test without drowning in framework/JDK internals.
Command cheat sheet (the ones you’ll actually use)
Start / resume
cont— continue execution from current stop/breakpointrun— start execution when jdb launched the VM (less relevant when you used-attach)
Breakpoints
stop in <class>.<method>— break on method entrystop at <class>:<line>— break at a specific linestop— list all breakpointsclear <class>.<method>/clear <class>:<line>— remove a breakpointclear— list breakpoints (same idea asstoplisting)
Stepping
next— step over calls (line-level)step— step into calls (line-level)step up— run until current method returnsstepi— step one bytecode instruction (rarely needed)
Threads / stacks
threads— list threadsthread <id>— select default threadwhere— stack trace for current threadwhere all— stack traces for all threadsup/down— move the current frame up/down the stack
Inspect state
locals— print locals in current frameprint <expr>— evaluate/print an expression (same aseval)dump <expr>— more complete object dumpset <lvalue> = <expr>— mutate a variable/field (use sparingly)
Source
list— show source around current linelist <line>orlist <method>— show a specific regionuse <path1>:<path2>(akasourcepath) — set where jdb looks for sources
Exceptions
catch uncaught <exception>— break when an uncaught exception occurscatch caught <exception>— break when a caught exception occurscatch all <exception>— break for both caught+uncaughtignore ...— undo a catch
Reduce noise
exclude <pattern>,<pattern>,...— don’t report step/method events for matching classesexclude none— clear exclusions
Automation
monitor <command>— run a command every time the program stops (e.g.,monitor where)read <file>— execute commands from a file!!— repeat last command<n> <command>— repeat command n times (e.g.,10 next)
Efficient workflow for failing JUnit tests
1) Add exclusions immediately (so stepping doesn’t become a swamp)
Rig
Установить debug-surefire в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл debug-surefire?
Debug Maven Surefire unit tests by running them in JDWP "wait for debugger" mode (`-Dmaven.surefire.debug`) and attaching to the forked test JVM using **jdb** (preferred for CLI/agent debugging), IntelliJ, or VS Code. Use when asked to debug/step through a failing JUnit test, attach a debugger to a Maven test run, or run `mvn test -Dtest=Class[#method]` suspended on a port (including multi-module `-pl` runs). The JVM will block at startup until a debugger attaches; the agent should attach with `jdb -attach <host>:<port>` and drive the session from the terminal.
Как установить скилл debug-surefire?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл debug-surefire запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic