{
  "id": "java/gradle-build-script-error",
  "signature": "Build file 'build.gradle' line: 12, error: Could not find method compile() for arguments [com.example:lib:1.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.",
  "signature_zh": "构建文件 'build.gradle' 第 12 行，错误：在 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 类型的对象上找不到方法 compile()，参数为 [com.example:lib:1.0]。",
  "regex": "Build\\ file\\ 'build\\.gradle'\\ line:\\ 12,\\ error:\\ Could\\ not\\ find\\ method\\ compile\\(\\)\\ for\\ arguments\\ \\[com\\.example:lib:1\\.0\\]\\ on\\ object\\ of\\ type\\ org\\.gradle\\.api\\.internal\\.artifacts\\.dsl\\.dependencies\\.DefaultDependencyHandler\\.",
  "domain": "java",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "The 'compile' configuration is deprecated since Gradle 4.0 and removed in Gradle 7.0; use 'implementation' instead.",
  "root_cause_type": "generic",
  "root_cause_zh": "'compile' 配置自 Gradle 4.0 起已弃用，并在 Gradle 7.0 中移除；请改用 'implementation'。",
  "versions": [
    {
      "version": "7+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Reverting to an older Gradle version",
      "why_fails": "This is a temporary fix and prevents using newer features or plugins.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using compileOnly as a direct replacement",
      "why_fails": "compileOnly does not include the dependency in the runtime classpath, which may cause NoClassDefFoundError.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Replace compile with implementation",
      "success_rate": 0.95,
      "how": "dependencies { implementation 'com.example:lib:1.0' }",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use api if the dependency needs to be exposed transitively",
      "success_rate": 0.9,
      "how": "dependencies { api 'com.example:lib:1.0' }",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}