Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create private Gradle task which is not visible on task list

Tags:

Is it possible to create private Gradle task which is not visible on task list (gradlew tasks)?

like image 410
Michal Z m u d a Avatar asked May 11 '14 23:05

Michal Z m u d a


People also ask

How do I exclude tasks in Gradle?

To skip any task from the Gradle build, we can use the -x or –exclude-task option. In this case, we'll use “-x test” to skip tests from the build. As a result, the test sources aren't compiled, and therefore, aren't executed.

Does Gradle build run all tasks?

You can execute multiple tasks from a single build file. Gradle can handle the build file using gradle command. This command will compile each task in such an order that they are listed and execute each task along with the dependencies using different options.


1 Answers

Gradle doesn't support marking a task as "private". However, gradle tasks will only show a task if it either has task.group set, or no other task depends on it. The idea behind this is that such a task is likely meant to be executed directly by the user. In contrast, gradle tasks --all will show all tasks.

like image 150
Peter Niederwieser Avatar answered Sep 22 '22 14:09

Peter Niederwieser