# 无法为项目 com.example:my-app:jar:1.0.0 解析依赖：在中央仓库 (https://repo.maven.apache.org/maven2) 中找不到工件 com.example:missing-lib:jar:2.0.0

- **ID:** `java/maven-dependency-not-found`
- **领域:** java
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

依赖工件未发布到配置的仓库，或仓库 URL 不正确。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 8+ | active | — | — |

## 解决方案

1. **Add the correct repository to pom.xml** (95% 成功率)
   ```
   <repositories><repository><id>my-repo</id><url>https://my-company.com/repo</url></repository></repositories>
   ```
2. **Install the dependency manually using mvn install:install-file** (90% 成功率)
   ```
   mvn install:install-file -Dfile=missing-lib-2.0.0.jar -DgroupId=com.example -DartifactId=missing-lib -Dversion=2.0.0 -Dpackaging=jar
   ```

## 无效尝试

- **Adding a random third-party repository without verifying its contents** — The repository may not contain the artifact, or it could be malicious. (90% 失败率)
- **Cleaning the local Maven repository (~/.m2/repository) without verifying the remote** — If the artifact is not in any remote repo, cleaning the local cache doesn't help. (85% 失败率)
