-
Notifications
You must be signed in to change notification settings - Fork 1
Instrument project code (process-classes / process-test-classes) #1
Copy link
Copy link
Open
Description
Summary
Add a new goal that enhances bytecode in target/classes/ and target/test-classes/ so developers can instrument their own project code, not just dependency jars.
Motivation
Currently, instrumentation only works on dependency jars (ProcessMojo swaps patched jars via Artifact.setFile()). But the primary debugging use case — a test fails, you need to see what your own code is doing — requires instrumenting project code.
Design
- Single goal, two executions bound to
process-classesandprocess-test-classesphases - Reads instrument configs from
.jackknife/instrument/(same as ProcessMojo) - Scans
.classfiles in the target directory, appliesHandlerEnhancerin place - Modified bytecode is what
testandpackagephases see — no classloader tricks needed
Example
mvn jackknife:instrument -Dclass=com.example.MyService -Dmethod=process
mvn test
Debug output appears when tests call MyService.process().
Acceptance Criteria
- Instrument a method in
src/main/java, verify debug output during test - Instrument a method in
src/test/java, verify debug output during test - Integration tests:
single-instrument-mainclass,single-instrument-testclass
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels