# Maven Code Graph

> Query Maven dependency JARs — search for classes, get method signatures, find implementations. Like codegraph for your project's external dependencies. Use when you need to know method signatures or class details from compiled Maven libraries.

- **Type:** Skill
- **Install:** `agentstack add skill-auver-maven-code-graph-maven-code-graph`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [auver](https://agentstack.voostack.com/s/auver)
- **Installs:** 0
- **Category:** [Search](https://agentstack.voostack.com/c/search)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [auver](https://github.com/auver)
- **Source:** https://github.com/auver/maven-code-graph/tree/main/skills/maven-code-graph
- **Website:** https://www.npmjs.com/package/maven-code-graph

## Install

```sh
agentstack add skill-auver-maven-code-graph-maven-code-graph
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# maven-code-graph — Maven 依赖代码图谱

像 codegraph 索引项目源码一样，maven-code-graph 索引当前项目的 Maven 依赖 JAR。

## 前置检查 — CLI 安装

**每次激活本 skill 时，必须先执行以下检测：**

```bash
which maven-code-graph 2>/dev/null || echo "NOT_INSTALLED"
```

如果输出 `NOT_INSTALLED`，自动执行：

```bash
npm install -g maven-code-graph
```

如果已安装，直接跳过。

## 何时使用

- 编码时想知道某个外部依赖类的方法签名
- 想查看接口/抽象类有哪些实现类
- 想确认依赖 JAR 中某个类是否存在
- 想看 `-sources.jar` 中的源码（或 Fernflower 反编译结果）

## 命令

### 首次使用 — 初始化

```bash
maven-code-graph init
```

解析当前项目 pom.xml，索引所有依赖的 JAR。后续 pom.xml 未变化时自动跳过。

### 搜索类

```bash
maven-code-graph search 
```

返回匹配的类全限定名、类型（class/interface/enum）以及来自哪个 artifact 的哪个版本。

### 查看类详情

```bash
# 方法签名（默认，javap 输出）
maven-code-graph class 

# 完整源码（优先 sources.jar，否则 Fernflower 反编译）
maven-code-graph class  --type source

# Javadoc
maven-code-graph class  --type docs

# 指定精确 artifact 版本
maven-code-graph class  --coordinate groupId:artifactId:version
```

### 查找实现类

```bash
maven-code-graph implementations 
```

### 查看索引状态

```bash
maven-code-graph status
```

## 注意事项

- 必须在 Maven 项目目录下运行
- 首次 `init` 需要 `mvn` 命令可用
- 索引数据存储在 `~/.maven-codegraph/artifacts.db`（全局共享）+ `.maven-codegraph/state.json`（每项目）
- 项目 pom.xml 变化后，下次命令会自动增量索引

## 反编译（Fernflower）

不少 Maven 依赖自带 `-sources.jar`，不需要反编译。对于没有源码的 JAR，`maven-code-graph` 使用 Fernflower 自动反编译。

Fernflower 需要 JDK 21+。`maven-code-graph` 按以下顺序自动查找：

1. `FERNFLOWER_JAVA` 环境变量（如果有指定路径）
2. IDEA 自带的 JBR（如果已安装 IntelliJ IDEA）
3. 系统 `java`（如果是 JDK 21+）

大多数开发者已安装 IDEA，开箱即用。没有 IDEA 也没有 JDK 21 的用户，可以设置 `FERNFLOWER_JAVA` 指向一个 JDK 21+ 的安装路径：

```bash
export FERNFLOWER_JAVA=/path/to/jdk21/bin/java
```

无源码的 JAR 无法反编译时（约 5% 的依赖），该类的方法索引会缺失，`--type source` 会降级为 javap 签名。

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [auver](https://github.com/auver)
- **Source:** [auver/maven-code-graph](https://github.com/auver/maven-code-graph)
- **License:** MIT
- **Homepage:** https://www.npmjs.com/package/maven-code-graph

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-auver-maven-code-graph-maven-code-graph
- Seller: https://agentstack.voostack.com/s/auver
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
