# 过滤资源 'src/main/resources/application.properties' 中的值 '${db.url}' 失败，项目 com.example:my-app：无法解析占位符 'db.url'。

- **ID:** `java/maven-resource-filtering-error`
- **领域:** java
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

Maven 资源过滤已启用，但占位符 ${db.url} 未在任何属性文件或 POM 中定义。

## 版本兼容性

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

## 解决方案

1. **Define the property in pom.xml** (95% 成功率)
   ```
   <properties><db.url>jdbc:mysql://localhost:3306/mydb</db.url></properties>
   ```
2. **Use a properties file with filtering enabled** (90% 成功率)
   ```
   Create src/main/filters/db.properties with db.url=jdbc:mysql://localhost:3306/mydb and add <filters><filter>src/main/filters/db.properties</filter></filters>
   ```

## 无效尝试

- **Disabling resource filtering entirely** — Other placeholders may need filtering, and disabling it breaks them. (70% 失败率)
- **Adding a random property with a different name** — The placeholder must match exactly; a different name won't be resolved. (90% 失败率)
