Task operations

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'. ...

Get Mastering Gradle now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.