# 无法从/向中央仓库 (https://repo.maven.apache.org/maven2) 传输工件 com.example:lib:1.0.0：收到致命警报：证书未知。位于 https://internal-mirror.com/maven2 的仓库镜像可能配置错误。

- **ID:** `java/maven-repository-mirror-loop`
- **领域:** java
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

镜像仓库的 SSL 证书不被 Java 运行时信任，或镜像配置错误。

## 版本兼容性

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

## 解决方案

1. **Import the mirror's SSL certificate into the Java truststore** (95% 成功率)
   ```
   keytool -import -alias mirror -keystore $JAVA_HOME/lib/security/cacerts -file mirror.crt
   ```
2. **Use HTTPS with a trusted certificate or switch to HTTP if allowed** (90% 成功率)
   ```
   <mirror><id>internal</id><url>http://internal-mirror.com/maven2</url><mirrorOf>central</mirrorOf></mirror>
   ```

## 无效尝试

- **Disabling SSL verification globally in settings.xml** — This is a security risk and may not be allowed in corporate environments. (80% 失败率)
- **Using a different mirror without verifying its certificate** — The new mirror may have the same issue or be malicious. (90% 失败率)
