java build_error ai_generated true

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

Failed to execute goal org.codehaus.mojo:license-maven-plugin:2.0.0:check (default) on project my-app: Some dependencies have incompatible licenses. See /path/to/license-summary.html

ID: java/maven-license-check-failure

其他格式: JSON · Markdown 中文 · English
80%修复率
85%置信度
0证据数
2025-09-05首次发现

版本兼容性

版本状态引入弃用备注
8+ active

根因分析

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

English

A dependency's license is not in the allowed list configured in the license-maven-plugin.

generic

解决方案

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

无效尝试

常见但无效的做法:

  1. Removing the dependency without checking if it's needed 80% 失败

    The code may rely on that dependency, causing compilation errors.

  2. Ignoring the license check by skipping the plugin 70% 失败

    The project may have legal requirements to enforce license compliance.