{
  "id": "java/maven-enforcer-dependency-convergence",
  "signature": "Dependency convergence error for com.google.guava:guava:jar:30.1-jre paths to dependency are:",
  "signature_zh": "com.google.guava:guava:jar:30.1-jre 的依赖收敛错误，依赖路径为：",
  "regex": "Dependency convergence error for.*paths to dependency are:",
  "domain": "java",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "Multiple versions of the same dependency (e.g., Guava) are resolved in the dependency tree with different versions, violating the Maven Enforcer plugin's dependency convergence rule, which requires a single version per artifact.",
  "root_cause_type": "generic",
  "root_cause_zh": "依赖树中解析了同一依赖（例如 Guava）的多个版本，违反了 Maven Enforcer 插件的依赖收敛规则，该规则要求每个工件只有一个版本。",
  "versions": [
    {
      "version": "Maven 3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Maven 3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "maven-enforcer-plugin 3.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "maven-enforcer-plugin 3.1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Remove the enforcer plugin entirely from the pom.xml",
      "why_fails": "This suppresses the build error but leaves the classpath with multiple versions, which can cause NoSuchMethodError or ClassCastException at runtime.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Manually exclude all conflicting transitive dependencies one by one",
      "why_fails": "This is tedious and error-prone; missing one exclusion still causes the error. It's better to use dependency management.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Use the latest version of the dependency in all places",
      "why_fails": "Simply using the latest version may introduce breaking changes from incompatible APIs; requires careful testing.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Add a <dependencyManagement> section in the parent pom.xml to force a specific version of the conflicting artifact. Example:\n<dependencyManagement>\n  <dependencies>\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n      <version>31.1-jre</version>\n    </dependency>\n  </dependencies>\n</dependencyManagement>",
      "success_rate": 0.9,
      "how": "Add a <dependencyManagement> section in the parent pom.xml to force a specific version of the conflicting artifact. Example:\n<dependencyManagement>\n  <dependencies>\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n      <version>31.1-jre</version>\n    </dependency>\n  </dependencies>\n</dependencyManagement>",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use the Maven Enforcer plugin's dependencyConvergence rule with excludes for known unavoidable conflicts:\n<execution>\n  <id>enforce</id>\n  <configuration>\n    <rules>\n      <dependencyConvergence>\n        <excludes>\n          <exclude>com.google.guava:guava</exclude>\n        </excludes>\n      </dependencyConvergence>\n    </rules>\n  </configuration>\n</execution>",
      "success_rate": 0.85,
      "how": "Use the Maven Enforcer plugin's dependencyConvergence rule with excludes for known unavoidable conflicts:\n<execution>\n  <id>enforce</id>\n  <configuration>\n    <rules>\n      <dependencyConvergence>\n        <excludes>\n          <exclude>com.google.guava:guava</exclude>\n        </excludes>\n      </dependencyConvergence>\n    </rules>\n  </configuration>\n</execution>",
      "condition": "",
      "sources": []
    },
    {
      "action": "Run 'mvn dependency:tree' to identify all paths and then add explicit <exclusions> in the specific dependency that brings the unwanted version.",
      "success_rate": 0.8,
      "how": "Run 'mvn dependency:tree' to identify all paths and then add explicit <exclusions> in the specific dependency that brings the unwanted version.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Add a <dependencyManagement> section in the parent pom.xml to force a specific version of the conflicting artifact. Example:\n<dependencyManagement>\n  <dependencies>\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n      <version>31.1-jre</version>\n    </dependency>\n  </dependencies>\n</dependencyManagement>",
    "Use the Maven Enforcer plugin's dependencyConvergence rule with excludes for known unavoidable conflicts:\n<execution>\n  <id>enforce</id>\n  <configuration>\n    <rules>\n      <dependencyConvergence>\n        <excludes>\n          <exclude>com.google.guava:guava</exclude>\n        </excludes>\n      </dependencyConvergence>\n    </rules>\n  </configuration>\n</execution>",
    "Run 'mvn dependency:tree' to identify all paths and then add explicit <exclusions> in the specific dependency that brings the unwanted version."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://maven.apache.org/enforcer/enforcer-rules/dependencyConvergence.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2023-06-01",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}