# 无效的版本格式：依赖 com.example:lib:1.0.0-SNAPSHOT 中的 '1.0.0-SNAPSHOT '（尾部空格）。

- **ID:** `java/maven-invalid-version-format`
- **领域:** java
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

版本字符串包含前导或尾部空格，Maven 版本解析器不允许。

## 版本兼容性

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

## 解决方案

1. **Trim whitespace from the version string in pom.xml** (100% 成功率)
   ```
   <version>1.0.0-SNAPSHOT</version> (no trailing spaces)
   ```
2. **Use a properties file to define the version without whitespace** (95% 成功率)
   ```
   <properties><lib.version>1.0.0-SNAPSHOT</lib.version></properties> and reference ${lib.version}
   ```

## 无效尝试

- **Using a different version without whitespace but not the intended one** — The dependency may not exist at that version, causing a resolution error. (80% 失败率)
- **Ignoring the error and hoping it works** — Maven will fail to parse the version and abort the build. (99% 失败率)
