# Multi-Module JVM Source Bundles in Sentry CLI

Published: 2026-04-30

Source: https://sentry.io/changelog/multi-module-jvm-source-bundles-in-sentry-cli

---

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:

```bash
sentry-cli debug-files bundle-jvm \
    --output ./out \
    --debug-id YOUR_UUID \
    ./path/to/root
```

The command walks the directory tree and:

- **Collects only JVM source files** (`.java`, `.kt`, `.scala`, `.groovy`, `.clj`)
- **Skips build output and IDE directories** (`build/`, `.gradle/`, `.idea/`, `target/`, etc.)
- **Respects `.gitignore`** - vendored dependencies and generated code won't end up in the bundle

## Handling Multi-Variant Projects

Android 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](https://github.com/getsentry/sentry-java) itself — excluding test sources, Android test sources, and the `buildSrc` directory:

```bash
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
```

## What This Means for You

- **No more wrapper scripts** - point at your project root and go
- **Source Context just works** - stack traces in Sentry show your actual source code, matched correctly even for Gradle/Maven layouts
- **CI-friendly** - a single command replaces multi-step source collection pipelines

Check out the [CLI docs on JVM Source Bundles](https://docs.sentry.io/cli/dif/#jvm-source-bundles) for the full reference, or the [Source Context setup guide](https://docs.sentry.io/platforms/android/source-context/) to get started.