Dependencies
Instrument methods in compile, runtime, provided, and test-scoped dependencies.
Supported scopes
All dependency scopes are supported: compile, runtime, provided,
and test. All scopes are on the test classpath, so instrumented methods
produce output during mvn test.
Command
mvn jackknife:instrument -Dclass=org.tomitribe.util.Join -Dmethod=join
What happens under the hood
- Searches manifests for the class
- Writes instrumentation config to
.jackknife/instrument/<groupId>/<jar>.properties - Next
mvn testtriggers theprocessgoal in the initialize phase - ProcessMojo reads the config and applies the HandlerEnhancer bytecode transformation
- Patched jar written to
.jackknife/modified/and swapped into the classpath viaArtifact.setFile() - The original jar in
~/.m2is never touched
Removal
To remove all instrumented jars and reset to the originals:
mvn jackknife:clean -Dpath=modified
The next mvn test will use the unmodified jars from ~/.m2.