Show List
Gradle Commands and Options
Here are some common Gradle commands and options.
Running the task
gradle taskname
//Running multiple tasks - Individual tasks are to be separated by space
gradle task1 task2 task3
Excluding the dependent task
gradle dist --exclude-task test
gradle dist -x test
// x is short cut for --exclude-task
Forcing to execute all the tasks
By default gradle will skip the tasks if there are no changes. This option is to force execution of all the tasks
gradle dist --rerun-tasks
Continue to execute
This is to continue the execution even if previous task fails to see all the tasks that would fail
gradle dist --continue
Build
This task is to assembling all outputs and running the checks
gradle build
Run
This task is to assemble the application and execute the script to run.
gradle run
Check
This task is for the common verifications.
gradle check
Clean
This is to delete the precomputed outputs.
gradle clean
Project list
Command to get the project list:
gradle projects
Tasks list
Command to get the tasks list:
gradle tasks
Project dependencies
Command to get list of project dependencies:
gradle dependencies
Logging options
Control the information displayed in the log.
- -q, --quiet: Log errors only.
- -w, --warn :Set log level to warn.
- -i, --info :Set log level to info.
- -d, --debug :Log in debug mode.
Example:
gradle task1 -q
Leave a Comment