Setting up Source Context for JVM projects used to require pointing sentry-cli debug-files bundle-jvm at a flat directory of source files. For projects with standard layouts (Gradle, Maven, multi-module), this meant manually listing every src/main/java, src/main/kotlin, etc. — or writing wrapper scripts to collect sources into a staging directory first.
Starting with sentry-cli 3.4.1, bundle-jvm accepts a project or module root and does the right thing automatically:
sentry-cli debug-files bundle-jvm \
--output ./out \
--debug-id YOUR_UUID \
./path/to/root
The command walks the directory tree and:
.java, .kt, .scala, .groovy, .clj)build/, .gradle/, .idea/, target/, etc.).gitignore - vendored dependencies and generated code won't end up in the bundleAndroid and other multi-variant projects often have overlapping source sets (src/main/, src/debug/, src/release/) where the same fully-qualified class name appears under multiple directories. When bundle-jvm detects a collision, it keeps the first occurrence and warns you about the rest:
WARN: URL collision on ~/com/example/Foo.jvm: skipping 'src/debug/java/com/example/Foo.java'
(already bundled from 'src/main/java/com/example/Foo.java').
Use --exclude to drop the unwanted source set (e.g. --exclude='**/src/debug/**').
Use --exclude to scope the bundle to the source sets you care about. For example, here's how we bundle sentry-java itself — excluding test sources, Android test sources, and the buildSrc directory:
sentry-cli debug-files bundle-jvm \
--output ./out \
--debug-id YOUR_UUID \
--exclude '**/src/test/**' \
--exclude '**/src/androidTest/**' \
--exclude '**/buildSrc/**' \
--exclude '**/build-logic/**' \
./path/to/root
Check out the CLI docs on JVM Source Bundles for the full reference, or the Source Context setup guide to get started.