If you are tired of typing complete task names in the command-line; here is a good option for you. If you have defined task names in camel case (camelCase) format, you can just execute the task by mentioning the first letter of each word. For example, you can execute the sampleTask1
task with shorthand sT1
:
$ gradle -q –b build_ordering.gradle sT1 sT2
This will execute sampleTask1
and sampleTask2
.
If the shorthand of camel case matches more than one task, it will result in ambiguity:
$ gradle -q -b build_ordering.gradle sT FAILURE: Build failed with an exception. * What went wrong: Task 'sT' is ambiguous in root project 'Chapter3'. Candidates are: 'sampleTask1', 'sampleTask2', 'sampleTask3', 'sampleTask4', 'sampleTask5', 'sampleTask6'. * Try: Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Now, we will explore some other task operations such as conditional...