The gradle command has the following usage:
gradle [option...] [task...]
The command-line options available for the gradle command are listed below:
-?, -h, --helpShows a help message.
-a, --no-rebuild (deprecated)Do not rebuild project dependencies.
--allShows additional detail in the task listing. See Section 4.7.2, “Listing tasks”.
-b, --build-fileSpecifies the build file. See Section 4.5, “Selecting which build to execute”.
--build-cache (incubating)Enables the Gradle build cache. Gradle will try to reuse outputs from previous builds.
--no-build-cache (incubating)Disables the Gradle build cache.
-c, --settings-fileSpecifies the settings file.
--consoleSpecifies which type of console output to generate.
Set to plain to generate plain text only. This option disables all color and other rich output in the console output.
Set to auto (the default) to enable color and other rich output in the console output when the build process is attached to a console, or to generate plain text only when not attached to a console.
Set to rich to enable color and other rich output in the console output, regardless of whether the build process is not attached to a console. When not attached to a console, the build output will use ANSI control characters to generate the rich output.
Set to verbose to enable color and other rich output like the rich, but output more detailed message (task name, output, etc.)
--continueContinues task execution after a task failure.
--configure-on-demand (incubating)Only relevant projects are configured in this build run. This means faster builds for large multi-projects. See the section called “Configuration on demand”.
--no-configure-on-demand (incubating)Disables the use of configuration on demand.
-D, --system-propSets a system property of the JVM, for example -Dmyprop=myvalue. See Section 12.2, “Gradle properties and system properties”.
-d, --debugLog in debug mode (includes normal stacktrace). See Chapter 24, Logging.
-g, --gradle-user-homeSpecifies the Gradle user home directory. The default is the .gradle directory in the user’s home directory.
--include-buildRun the build as a composite, including the specified build. See Chapter 11, Composite builds.
-I, --init-scriptSpecifies an initialization script. See Chapter 45, Initialization Scripts.
-i, --infoSet log level to info. See Chapter 24, Logging.
-m, --dry-runRuns the build with all task actions disabled. See Section 4.8, “Dry Run”.
--offlineSpecifies that the build should operate without accessing network resources. See Section 25.9.2, “Command line options to override caching”.
-P, --project-propSets a project property of the root project, for example -Pmyprop=myvalue. See Section 12.2, “Gradle properties and system properties”.
-p, --project-dirSpecifies the start directory for Gradle. Defaults to current directory. See Section 4.5, “Selecting which build to execute”.
--parallel (incubating)Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use. This option should only be used with decoupled projects (see Section 26.9, “Decoupled Projects”). For limitations of this option please see Section 26.8, “Parallel project execution”.
--no-parallel (incubating)Disables parallel execution to build projects.
--max-workers (incubating)Sets the maximum number of workers that Gradle may use. For example --max-workers=3. The default is the number of processors.
--profileProfiles build execution time and generates a report in the buildDir/reports/profile directory. See Section 4.7.8, “Profiling a build”.
--project-cache-dirSpecifies the project-specific cache directory. Default value is .gradle in the root project directory.
-q, --quietLog errors only. See Chapter 24, Logging.
--recompile-scripts (deprecated)Forces scripts to be recompiled, bypassing caching. This option has been deprecated and is scheduled to be removed Gradle 5.0. You should avoid using it.
--refresh-dependenciesRefresh the state of dependencies. See Section 25.9.2, “Command line options to override caching”.
--rerun-tasksSpecifies that any task optimization is ignored.
-S, --full-stacktracePrint out the full (very verbose) stacktrace for any exceptions. See Chapter 24, Logging.
-s, --stacktracePrint out the stacktrace also for user exceptions (e.g. compile error). See Chapter 24, Logging.
--scan (incubating)Creates a build scan. Gradle will auto-apply the build scan plugin with a compatible version. For more information about build scans, please visit https://gradle.com/build-scans.
--no-scan (incubating)Disables the creation of a build scan. For more information about build scans, please visit https://gradle.com/build-scans.
-t, --continuous (incubating)Enables continuous building - Gradle will automatically re-run when changes are detected.
-u, --no-search-upwardDon’t search in parent directories for a settings.gradle file.
-v, --versionPrints version info.
-w, --warnSet log level to warn. See Chapter 24, Logging
-x, --exclude-taskSpecifies a task to be excluded from execution. See Section 4.2, “Excluding tasks”.
The above information is printed to the console when you execute gradle -h.
The Chapter 7, The Gradle Daemon contains more information about the daemon. For example it includes information how to turn on the daemon by default so that you can avoid using --daemon all the time.
--daemonUses the Gradle daemon to run the build. Starts the daemon if not running or existing daemon busy. Chapter 7, The Gradle Daemon contains more detailed information when new daemon processes are started.
--no-daemonDoes not use the Gradle daemon to run the build.
--foregroundStarts the Gradle daemon in the foreground. Useful for debugging or troubleshooting because you can easily monitor the build execution.
--no-daemonDo not use the Gradle daemon to run the build. Useful occasionally if you have configured Gradle to always run with the daemon by default.
--statusList running and recently stopped Gradle daemons. Only displays daemons of the same Gradle version.
--stopStops the Gradle daemon if it is running. You can only stop daemons that were started with the Gradle version you use when running --stop.
The following system properties are available for the gradle command. Note that command-line options take precedence over system properties.
gradle.user.homeSpecifies the Gradle user home directory.
The Section 12.1, “Configuring the build environment via gradle.properties” contains specific information about Gradle configuration available via system properties.
The following environment variables are available for the gradle command. Note that command-line options and system properties take precedence over environment variables.
GRADLE_OPTSSpecifies command-line arguments to use to start the JVM. This can be useful for setting the system properties to use for running Gradle. For example you could set GRADLE_OPTS="-Dorg.gradle.daemon=true" to use the Gradle daemon without needing to use the --daemon option every time you run Gradle. Section 12.1, “Configuring the build environment via gradle.properties” contains more information about ways of configuring the daemon without using environmental variables, e.g. in more maintainable and explicit way.
GRADLE_USER_HOMESpecifies the Gradle user home directory (which defaults to “USER_HOME/.gradle” if not set).
JAVA_HOMESpecifies the JDK installation directory to use.