Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

gradle-troubleshooting梯度故障排除

Agent Skill

用于辅助 Java 项目开发、面向对象设计、Spring 生态、Maven 或 Gradle 依赖和后端工程实践。它适合让 Agent 分析类结构、设计接口、整理服务分层、生成测试或检查常见代码坏味道。使用时需要结合项目已有架构、包结构和依赖版本,不应只按通用教程改代码;涉及数据库、事务、并发或框架配置时,应先确认运行环境和回归测试范围。

总安装

222

周安装

9

GitHub Stars

1

下载量

70
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:gradle-troubleshooting(梯度故障排除)
来源仓库:https://github.com/dawiddutoit/custom-claude
仓库路径:skills/gradle-troubleshooting
安装命令:
npx skills add https://github.com/dawiddutoit/custom-claude --skill gradle-troubleshooting
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dawiddutoit/custom-claude --skill gradle-troubleshooting

简介

用于诊断 Gradle 构建过程中的各类异常与错误根源。

  • 适合解决依赖下载失败、任务循环依赖、内存溢出等问题。
  • 结合日志分析与环境变量,定位跨平台兼容性问题。
  • 需具备查看完整构建输出及系统环境变量的权限。gradle-troubleshooting 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 注意:某些问题可能与本地缓存或代理设置相关,需人工介入排查。

SKILL.md

Gradle Troubleshooting

Table of Contents

When to Use This Skill

Use this skill when you need to:

  • Debug OutOfMemoryError or heap space issues
  • Resolve dependency conflicts and version mismatches
  • Fix build cache or configuration cache problems
  • Diagnose slow build performance
  • Troubleshoot daemon or wrapper issues
  • Debug plugin loading failures
  • Resolve TestContainers or Docker connectivity issues
  • Investigate test failures in CI but not locally

Quick Start

When a build fails, run in order:

# 1. Stop daemon and clean
./gradlew --stop
./gradlew clean

# 2. Run with diagnostics
./gradlew build --stacktrace --info

# 3. If still failing, generate build scan
./gradlew build --scan

# 4. If slow, profile
./gradlew build --profile

Instructions

Step 1: Diagnose with Debug Output

Run with increasing verbosity to identify the issue:

# Stack trace (shows where error occurred)
./gradlew build --stacktrace

# Full stack trace (complete call stack)
./gradlew build --full-stacktrace

# Info logging (what Gradle is doing)
./gradlew build --info

# Debug logging (very detailed, generates lots of output)
./gradlew build --debug

# Use grep to filter
./gradlew build --info 2>&1 | grep -i error
./gradlew build --info 2>&1 | grep cache

Step 2: Identify the Issue Category

OutOfMemoryError:

./gradlew build 2>&1 | grep -i "outofmemory\|java heap\|metaspace"

Dependency resolution:

./gradlew dependencies --info 2>&1 | grep -i "could not\|failed\|error"
./gradlew dependencyInsight --dependency spring-core

Build cache problems:

./gradlew build --no-build-cache --info 2>&1 | grep cache

Configuration cache:

./gradlew build --no-configuration-cache --info

Plugin issues:

./gradlew build --stacktrace 2>&1 | grep -A 5 "plugin"

Step 3: Fix OutOfMemoryError

Immediate fix - Increase heap size:

# For this build only
./gradlew build -Dorg.gradle.jvmargs="-Xmx8g"

# Or stop daemon and increase persistent memory
./gradlew --stop

Permanent fix - Update gradle.properties:

# For standard projects (10-30 modules)
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# For large projects (30+ modules)
org.gradle.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=2g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# For very large projects
org.gradle.jvmargs=-Xmx12g -XX:MaxMetaspaceSize=3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

Verify fix:

./gradlew --stop  # Must restart daemon
./gradlew build --info 2>&1 | grep "XX:Xmx"

Step 4: Debug Dependency Resolution

Understand why dependencies aren't resolving:

# Show full dependency tree
./gradlew dependencies

# Show specific configuration
./gradlew dependencies --configuration implementation

# Find where a dependency comes from
./gradlew dependencyInsight --dependency spring-core

# Show dependency insights for specific config
./gradlew dependencyInsight --dependency jackson-databind --configuration implementation

# Refresh and re-download
./gradlew build --refresh-dependencies

Common solutions:

Option 1: Force specific version:

// build.gradle.kts
configurations.all {
    resolutionStrategy {
        force("com.google.guava:guava:32.1.3-jre")
    }
}

Option 2: Exclude problematic transitive dependency:

dependencies {
    implementation("com.example:library:1.0") {
        exclude(group = "commons-logging", module = "commons-logging")
    }
}

Option 3: Use dependency constraints:

dependencies {
    constraints {
        implementation("org.apache.commons:commons-lang3:3.18.0")
    }
}

Step 5: Debug Build Cache Issues

Test if build cache is causing problems:

# Disable cache for this build
./gradlew build --no-build-cache

# If this fixes it, cache is the problem
# Clean cache
rm -rf ~/.gradle/caches/build-cache-*

# Check cache status
./gradlew build --build-cache --info | grep cache

# Verify task is cacheable
./gradlew build --info 2>&1 | grep "Cache key"

Common build cache issues:

Issue: Build slower with cache enabled

# Check for non-cacheable tasks
./gradlew build --info 2>&1 | grep -i "non-cacheable"

Issue: Incorrect cached results

# Clean entire cache
rm -rf ~/.gradle/caches

# Rebuild
./gradlew build

Step 6: Debug Configuration Cache

Test if configuration cache is compatible:

# Start with warnings (not errors)
./gradlew build --configuration-cache-problems=warn

# Check report
# build/reports/configuration-cache/<hash>/configuration-cache-report.html

# Once issues fixed, enable strict mode
./gradlew build --configuration-cache-problems=fail

Common configuration cache issues:

Issue: Build fails with configuration cache

# Disable temporarily
./gradlew build --no-configuration-cache

# Check for incompatible plugins
./gradlew build --configuration-cache-problems=warn --info

# View detailed report
open build/reports/configuration-cache/report.html

Issue: Plugins not compatible

# Update plugins to latest versions
./gradlew wrapper --gradle-version 9.2
./gradlew build -x test  # Skip tests temporarily

For advanced troubleshooting including slow build analysis, daemon management, wrapper issues, and plugin resolution, see references/advanced-troubleshooting.md.

Examples

Example 1: Complete Troubleshooting Workflow

# 1. Initial failure
./gradlew build
# BUILD FAILED

# 2. Get details
./gradlew build --stacktrace
# Shows: OutOfMemoryError: Java heap space

# 3. Fix: Update gradle.properties
echo "org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g" >> gradle.properties

# 4. Stop daemon and retry
./gradlew --stop
./gradlew build

# BUILD SUCCESSFUL

Example 2: Dependency Conflict Resolution

# Build fails with version conflict
./gradlew build
# ERROR: Could not resolve dependency: conflicting versions

# Investigate
./gradlew dependencyInsight --dependency commons-lang3

# You see:
# commons-lang3:3.8.1 <- old-library
# commons-lang3:3.18.0 <- new-library

# Solution: Force newer version
# In build.gradle.kts:
configurations.all {
    resolutionStrategy {
        force("org.apache.commons:commons-lang3:3.18.0")
    }
}

./gradlew build
# BUILD SUCCESSFUL

For advanced examples including slow build analysis, configuration cache debugging, and Docker troubleshooting, see references/advanced-examples.md.

Commands Reference

See references/commands-and-checklists.md for complete command reference, troubleshooting checklist, and quick reference table.

See Also

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.12%
按下载量换算24

Claude

32.8%
按下载量换算23

Cursor

20.23%
按下载量换算14

Gemini CLI

9.51%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills