# jdx tree

IDE equivalent: External library browser (artifacts)

Show the package forest of each matching artifact (jar file name or JDK module; default '*' — every artifact). --depth caps nesting (0 shows top segments only), --counts adds per-package subtree type counts. Exits 1 when no artifact matches.

## Usage

```text
jdx tree [<options>] [<artifact>]
```

## Example

```console
$ jdx tree 'gson*' --depth 3 --coord com.google.code.gson:gson:2.14.0
package tree for 'gson*'
gson-2.14.0.jar
  com
    com.google
      com.google.gson
        com.google.gson.annotations
        com.google.gson.internal
        com.google.gson.reflect
        com.google.gson.stream
warning MULTI_RELEASE_VARIANT: multi-release gson-2.14.0.jar serves version-specific variants for this JDK (21)
```

## Options

| Option | Description |
|---|---|
| `--depth=<int>` | Maximum package nesting shown (default 8; 0 shows top-level segments only). |
| `--counts` | Show per-package subtree type counts. |
| `--limit=<int>` | Maximum package nodes shown (default 50); the rest become a truncation footer. |
| `--jars=<text>` | Binary roots: jar files, class directories or globs (repeatable). Merge in front of the selected workspace's roots. |
| `-w, --workspace=<text>` | Use a named workspace (see jdx ws). Explicit --jars merge in front of it. |
| `--no-jdk` | Do not include the running JDK's stdlib (included by default). |
| `--coord=<text>` | Maven coordinate root group:artifact:version (repeatable). Resolved from ~/.gradle/caches and ~/.m2 first; with --fetch, downloaded from Maven repositories into <cache-dir>/m2 with checksum verification. Merges in front of the workspace. |
| `--repo=<text>` | Maven repository base URL for --coord fetches (repeatable, e.g. --repo https://repo.example.com/maven2). Tried in flag order before Maven Central, which stays last as the fallback. Must be an http(s) URL. |
| `--fetch` | Allow downloading --coord artifacts (and their -sources.jar) from Maven repositories (Central by default, --repo to add mirrors). Without it, coordinates resolve from the local caches only. |
| `--json` | Emit machine-readable JSON instead of human-readable text (same information, D-007). |
| `--no-color` | Disable ANSI colors even on a TTY (piped output is always plain). |
| `--no-daemon` | Force in-process execution: do not forward this query to the background daemon even when its socket answers (PROPOSAL.md §14.1). |
| `-h, --help` | Show this message and exit |

## Arguments

| Argument | Description |
|---|---|
| `<artifact>` | Artifact glob: jar file name or JDK module (default '*' — every artifact). |

## Full help text

```console
$ jdx tree --help
Usage: jdx tree [<options>] [<artifact>]

  Show the package forest of each matching artifact (jar file name or JDK module; default '*' — every artifact). --depth caps nesting (0 shows top segments only), --counts adds per-package subtree type counts. Exits 1 when no artifact matches.

Options:
  --depth=<int>           Maximum package nesting shown (default 8; 0 shows top-level segments only).
  --counts                Show per-package subtree type counts.
  --limit=<int>           Maximum package nodes shown (default 50); the rest become a truncation footer.
  --jars=<text>           Binary roots: jar files, class directories or globs (repeatable). Merge in front of the selected workspace's roots.
  -w, --workspace=<text>  Use a named workspace (see jdx ws). Explicit --jars merge in front of it.
  --no-jdk                Do not include the running JDK's stdlib (included by default).
  --coord=<text>          Maven coordinate root group:artifact:version (repeatable). Resolved from ~/.gradle/caches and ~/.m2 first; with --fetch, downloaded from Maven repositories into <cache-dir>/m2 with checksum verification. Merges in front of the workspace.
  --repo=<text>           Maven repository base URL for --coord fetches (repeatable, e.g. --repo https://repo.example.com/maven2). Tried in flag order before Maven Central, which stays last as the fallback. Must be an http(s) URL.
  --fetch                 Allow downloading --coord artifacts (and their -sources.jar) from Maven repositories (Central by default, --repo to add mirrors). Without it, coordinates resolve from the local caches only.
  --json                  Emit machine-readable JSON instead of human-readable text (same information, D-007).
  --no-color              Disable ANSI colors even on a TTY (piped output is always plain).
  --no-daemon             Force in-process execution: do not forward this query to the background daemon even when its socket answers (PROPOSAL.md §14.1).
  -h, --help              Show this message and exit

Arguments:
  <artifact>  Artifact glob: jar file name or JDK module (default '*' — every artifact).
```

## Learn more

Guide: [Reading code](https://mohammadmd1383.github.io/jdx/docs/reading-code/) · [All commands](https://mohammadmd1383.github.io/jdx/docs/reference/)
