Skip to content
Latchkey

gradle check: Run All Verification Tasks

gradle check is the aggregate verification task: by default it depends on test, and quality plugins (checkstyle, spotbugs, jacoco) wire themselves into it.

check is the gate most teams want CI to enforce. It is the single task that runs tests and every static-analysis check that has been configured.

What it does

The check lifecycle task depends on test out of the box. Plugins extend it: the checkstyle, pmd, spotbugs, and jacoco plugins each add checkX tasks as dependencies of check, so a single ./gradlew check runs tests and all static analysis.

Common usage

Terminal
./gradlew check
./gradlew check -x test          # quality checks without tests
./gradlew check --continue       # run all checks, report every failure

Flags

FlagWhat it does
--continueDo not stop at the first failing check
-x <task>Exclude a verification task
--infoShow which checks ran
--rerun-tasksIgnore up-to-date and re-run everything

In CI

Use ./gradlew check --continue so one failing module does not hide failures elsewhere; you get a full report in a single run. Cache ~/.gradle so the analysis tools are not re-downloaded each job.

Common errors in CI

"Execution failed for task ':checkstyleMain'" with "Checkstyle rule violations were found" means a lint gate failed; the report path is in the message. "Execution failed for task ':test'" is a test failure. If check does nothing, no verification plugin is applied, so only test runs (and there may be no tests).

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →