src/main/skills/running_gradle_builds/SKILL.md
Executes and orchestrates Gradle builds with background management, surgical task output capturing, and structured failure diagnostics; ALWAYS use instead of `./gradlew` for core lifecycle tasks (build, assemble), dev servers, and troubleshooting. Do NOT use for running tests (use `running_gradle_tests`) or dependency graph auditing.
npx skillsauth add rnett/gradle-mcp running_gradle_buildsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Executes Gradle builds with managed background orchestration and surgical failure diagnostics.
gradle tool instead of ./gradlew via shell.projectRoot.--rerun-tasks unless investigating project-wide cache-specific corruption; prioritize Gradle's native caching. Prefer --rerun for individual tasks to ensure they are executed even if up-to-date.captureTaskOutput when you need the isolated output of a specific task (e.g., help, dependencies).query_build()) to manage active processes and historical results.query_build for all diagnostics. It is more token-efficient than reading raw console logs and provides structured access to failures.stopBuildId to release resources when finished.query_buildThe query_build tool is your primary window into build results. Use it to move from high-level summaries to deep-dive diagnostics.
Call query_build() without arguments to see the Build Dashboard. This shows active background builds and recently completed builds with their BuildId, status, and failure counts.
query_build()Provide a buildId to get a summary of that specific build, including failures, problems, and test results. This summary also contains a guide on how to inspect specific details.
query_build(buildId="ID")To get exhaustive information, ALWAYS use the appropriate kind combined with a specific query:
kind="TESTS", query="FullTestName" (REQUIRED for full output/stack trace).
query (for tasks/tests) and taskPath support unique prefix matching. Providing a unique prefix (e.g., query="com.example.MyTest" or taskPath=":app:compile") will automatically select the item if it's
unambiguous.kind="TASKS", query=":path:to:task".kind="FAILURES", query="ID" (find IDs in the build summary).kind="PROBLEMS", query="ID" (find IDs in the build summary).
|- Console Logs: kind="CONSOLE". Use query as a regex filter if needed.
|- Full Export: Use outputFile="path/to/file.txt" to write the entire result (e.g., full console output, all tests) to a file, bypassing pagination limits and reducing token usage.Use wait_build with timeout, waitFor, or waitForTask to block until a condition is met in a background build.
wait_build(buildId="ID", timeout=60, waitFor="Started Application")timeout is set without a wait condition (waitFor/waitForTask), the tool waits for the build to finish.While a build is running, the progress notification (and the query_build summary) provides real-time counts of passed, failed, and skipped tests. This gives immediate feedback on the health of the test suite.
query_build(buildId="ID") repeatedly to see updated test counts: (5 passed, 1 failed).wait_build(timeout=...).background: true ONLY for tasks that must remain active (e.g., bootRun, continuous builds) or when you explicitly intend to perform independent research while the build proceeds.query_build and wait_build: Use query_build to check the status of background builds or to perform deep-dives into any historical build started by the server. Use wait_build for blocking waits.projectRoot: Provide projectRoot as an absolute file system path to all Gradle MCP tools. Relative paths are not supported.query_build() without arguments to view the build dashboard and ensure no orphaned background builds are consuming system resources.Gradle utilizes two primary ways to identify tasks from the command line. Precision here prevents running redundant tasks in multi-project builds.
Providing a task name without a leading colon (e.g., test, build) acts as a selector. Gradle will execute that task in every project (root and all subprojects) that contains a task with that name.
gradle(commandLine=["test"]) -> Executes test in all projects.Providing a task path with a leading colon (e.g., :test, :app:test) targets a single specific project.
gradle(commandLine=[":test"]) -> Executes test in the root project ONLY.gradle(commandLine=[":app:test"]) -> Executes test in the 'app' subproject ONLY.build, assemble, or clean with maximum reliability and clean, parseable output.bootRun) or continuous builds where background management and real-time log monitoring are required.query_build diagnostic suite. For test failures, ALWAYS use kind="TESTS" with
query="FullTestName".help or properties) without the noise of the full build log.["clean", "build"]).gradle with the commandLine.query_build with the buildId for deeper diagnostics.background: true to receive a BuildId.wait_build(buildId=ID, timeout=..., waitFor=...) to block until a specific state or log pattern is reached.query_build() (no arguments) to manage active jobs in the dashboard.gradle(stopBuildId=ID) once its utility is complete.{
"commandLine": ["build"]
}
// Reasoning: Using a task selector to verify build health across the entire multi-project structure.
{
"commandLine": [":app:test"]
}
// Reasoning: Using an absolute path to target a specific module, minimizing execution time and context usage.
{
"commandLine": [":app:help", "--task", "test"],
"captureTaskOutput": ":app:help"
}
// Reasoning: Using captureTaskOutput to retrieve clean, isolated documentation for the 'test' task without Gradle's general console noise.
// 1. Start the server in the background
{
"commandLine": [":app:bootRun"],
"background": true
}
// Response: { "buildId": "build_123" }
// 2. Wait for the 'Started Application' log pattern
{
"buildId": "build_123",
"timeout": 60,
"waitFor": "Started Application"
}
// Reasoning: Using background orchestration to allow the server to remain active while waiting for a specific readiness signal.
BuildId is not recognized, it may have expired from the recent history cache. Check the dashboard (query_build()) for valid active and historical IDs.captureTaskOutput matches exactly one of the tasks in the commandLine.invocationArguments: { envSource: "SHELL" } if Gradle cannot find expected env vars (e.g., JAVA_HOME).tools
Provides authoritative guidance for ALL Gradle operations: executing builds, running tests with surgical filtering, introspecting project structure, creating modules, and diagnosing failures; ALWAYS use instead of raw shell `./gradlew` for build execution, test runs, task introspection, module creation, performance audits, and documentation research. Do NOT use for dependency graph auditing/updates (use `managing_gradle_dependencies`) or dependency/plugin/Gradle source exploration (use `exploring_dependency_sources`).
tools
Reads and searches source code across ALL scopes: external library dependencies, plugins (buildscript), and Gradle Build Tool internal source code; use whenever you need to UNDERSTAND an API — its shape, signature, parameters, overloads, or implementation — before writing any code that calls it; covers project dependencies (via project/configuration/source set scope), plugins (via `sourceSetPath=":buildscript"`), and Gradle internals (via `gradleSource: true`). Prefer this over the REPL for all API research; reading source is instantaneous and complete. Do NOT use for project source code (use grep/tilth), Gradle documentation (use `gradle_docs` via the `gradle` skill), or Maven Central discovery (use `managing_gradle_dependencies`).
development
Audits and manages Gradle dependency graphs with high-resolution update checks, transitive tree analysis, and Maven Central discovery; use for dependency auditing, finding stable updates, and resolving GAV coordinates. Do NOT use for exploring dependency source code (use `exploring_dependency_sources`) or running builds/tests (use `gradle`).
development
Executes Kotlin code interactively within the project's full JVM classpath. Use when you need to RUN code: verify runtime behavior, experiment with logic, or render Compose UI previews. Do NOT use to understand an API's shape or signature — read its source with `exploring_dependency_sources` instead.