DevTools

Gradle CLI

Gradle commands for Java/Kotlin build automation.

31 commands
Windows MacOS Linux
#java #build-tool

Build Tasks

Compile, test, and assemble the project
gradle build
Delete the build directory
gradle clean
Compile and package without running tests
gradle assemble
List all available tasks
gradle tasks
List all tasks including subtasks
gradle tasks --all
Build the project skipping tests
gradle build -x test
Execute tasks in parallel
gradle build --parallel

Dependencies

Display the dependency tree
gradle dependencies
Show deps for a config
gradle dependencies --configuration implementation
Show insight into a specific dependency
gradle dependencyInsight --dependency guava
Show buildscript dependencies
gradle buildEnvironment
Force refresh of all dependencies
gradle refreshDependencies

Testing

Run all unit tests
gradle test
Run a specific test class
gradle test --tests "com.example.MyTest"
Run tests matching a pattern
gradle test --tests "*ServiceTest"
Run tests with detailed logging
gradle test --info
Stop on first test failure
gradle test --fail-fast
Generate code coverage report
gradle jacocoTestReport

Publishing

Publish to configured repositories
gradle publish
Publish to local Maven repository
gradle publishToMavenLocal
gradle generatePomFileForMavenPublication # Generate the POM file

Configuration

Display Gradle version information
gradle --version
Show all project properties
gradle properties
Build with a Gradle build scan
gradle build --scan
Build with profiling report
gradle build --profile
Update Gradle wrapper to a version
gradle wrapper --gradle-version 8.5
Build using the Gradle daemon
gradle build --daemon
Stop all running Gradle daemons
gradle --stop

Quick Commands

Compile source code, run tests, and assemble the project artifacts
gradle build
Display the full dependency tree for all configurations
gradle dependencies
Run a specific test class by its fully qualified name
gradle test --tests "com.example.MyTest"