# 在项目 my-app 上执行目标 org.codehaus.mojo:license-maven-plugin:2.0.0:check (default) 失败：某些依赖具有不兼容的许可证。请参阅 /path/to/license-summary.html。

- **ID:** `java/maven-license-check-failure`
- **领域:** java
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

依赖的许可证不在 license-maven-plugin 配置的允许列表中。

## 版本兼容性

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

## 解决方案

1. **Add the license to the allowed list in pom.xml** (90% 成功率)
   ```
   <plugin><groupId>org.codehaus.mojo</groupId><artifactId>license-maven-plugin</artifactId><configuration><allowedLicenses><license><name>Apache 2.0</name></license></allowedLicenses></configuration></plugin>
   ```
2. **Exclude the dependency with an incompatible license and find an alternative** (85% 成功率)
   ```
   <dependency><groupId>com.example</groupId><artifactId>lib</artifactId><exclusions><exclusion><groupId>problematic-group</groupId><artifactId>problematic-artifact</artifactId></exclusion></exclusions></dependency>
   ```

## 无效尝试

- **Removing the dependency without checking if it's needed** — The code may rely on that dependency, causing compilation errors. (80% 失败率)
- **Ignoring the license check by skipping the plugin** — The project may have legal requirements to enforce license compliance. (70% 失败率)
