Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to list task dependencies in Gradle?

Tags:

gradle

./gradle tasks lists "some" of the tasks. Looking at http://gradle.org/docs/current/userguide/java_plugin.html there are hidden ones not listed. Also, other plugins will not have such a nice pretty graph of the dependencies between tasks.

Is there a way to

  1. list all the tasks in all plugins with gradle
  2. list the tasks and what tasks they depend on (sort of like maven's dependency:tree but for tasks)
like image 359
Dean Hiller Avatar asked May 02 '12 21:05

Dean Hiller


People also ask

How do I list tasks in Gradle?

To get an overview of all Gradle tasks in our project, we need to run the tasks task. Since Gradle 5.1, we can use the --group option followed by a group name. Gradle will then show all tasks belonging to the group and not the other tasks in the project.

How do I get dependencies in Gradle?

The dependency tree in a build scan renders the selection reason (conflict resolution) as well as the origin of a dependency if you click on a dependency and select the "Required By" tab. Every Gradle project provides the task dependencyInsight to render the so-called dependency insight report from the command line.

Which Gradle display available tasks?

To see which tasks are available for our build we can run Gradle with the command-line option -t or --tasks. Gradle outputs the available tasks from our build script. By default only the tasks which are dependencies on other tasks are shown. To see all tasks we must add the command-line option --all.


2 Answers

list the tasks and what tasks they depend on (sort of like maven's depenceny:tree but for tasks)

for this you can use --dry-run (or -m) option which lists tasks which are executed in order for particular command, but does not execute the command, e.g.

gradle assemble --dry-run 

you can find more here

like image 89
Marko Vranjkovic Avatar answered Dec 07 '22 05:12

Marko Vranjkovic


Prior to Gradle 3.3, you could use the --all flag to get a more detailed listing of the available tasks and the task dependencies:

gradle tasks --all 

The dependency reporting was removed from this task as of Gradle 3.3 for performance reasons. This change and its rationale was documented in the Gradle 3.3 release notes.

like image 21
Rene Groeschke Avatar answered Dec 07 '22 05:12

Rene Groeschke