zoukankan      html  css  js  c++  java
  • Maven编译错误记录:Some Enforcer rules have failed

    一、错误信息

           添加httpclient与httpcore依赖后编译Maven报错。

           错误信息如下:

    Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce (enforce-banned-dependencies) on project manager: 
    Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed.

    二、错误定位

           根据错误信息,定位到pom.xml的enforce-banned-dependencies。可能发生的错误:Java编译版本问题、被禁止依赖冲突问题。排除Java编译版本问题,查看新添加依赖包maven文件,dependency内容如下:

    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <scope>compile</scope>
    </dependency>

      由此,基本确定问题所在。

    三、错误解决

           在项目pom.xml文件新添加dependency元素节点中,添加子元素排除依赖冲突:

    <exclusions>
      <exclusion>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
      </exclusion>
    </exclusions>

      重新编译,错误解决。

  • 相关阅读:
    LintCode "Binary Tree Serialization"
    LeetCode "Find the Duplicate Number"
    LintCode "Route Between Two Nodes in Graph"
    LintCode "Search a 2D Matrix II"
    LintCode "Submatrix Sum"
    LintCode "Sort Letters by Case"
    LeetCode "Peeking Iterator"
    LintCode "Sort Colors II"
    LeetCode "Move Zeroes"
    LintCode "Update Bits"
  • 原文地址:https://www.cnblogs.com/fantastic-clouds/p/8064790.html
Copyright © 2011-2022 走看看