Skip to content
Gradle plugin that adds a 'taskTree' task that prints task dependency tree
Groovy Java
Branch: master
Clone or download
dorongold Task configuration avoidance
Register the taskTree task lazily.
This might help slightly with preformance when
the taskTree task is NOT run.

resolves #35
Latest commit 691d4ae Jan 1, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper Bump version to 1.3.1 Oct 8, 2018
src Task configuration avoidance Jan 4, 2020
.gitignore Add deployment block to travis config Feb 26, 2017
.travis.yml Add Travis CI badge and version badge to README Mar 4, 2017
CHANGELOG.md Update CHANGELOG.md Jan 2, 2020
LICENSE Initial commit Sep 17, 2015
README.md Bump version to 1.5 Jan 1, 2020
build.gradle Update build.gradle Dec 9, 2019
gradle.properties.enc Add deployment block to travis config Feb 26, 2017
gradlew
gradlew.bat Update gradle wrapper to 3.1 Oct 1, 2016
settings.gradle Change project name to 'task-tree' Sep 28, 2015

README.md

Gradle Task Tree

version

Gradle plugin that adds a taskTree task that prints task dependency tree report to the console.

The task dependency tree is printed with a similar format to that of the built-in dependencies task.

Installation

The plugin can be configured in the build script or in an init script.

The plugin is published on Gradle Plugin Portal.

Build Script Snippet

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.com.dorongold.plugins:task-tree:1.5"
  }
}

apply plugin: "com.dorongold.task-tree"

Alternative Build Script Snippet (using the incubating "plugins" mechanism ):

plugins {
    id "com.dorongold.task-tree" version "1.5"
}

Init Script Snippet

To use this plugin in all your projects, put the following in a file named init.gradle in the $USER_HOME/.gradle/ directory, or any file ending in .gradle in the $USER_HOME/.gradle/init.d/ directory. See here for more information on initialization scripts.

initscript {
    repositories {
        maven { url "https://plugins.gradle.org/m2" }
    }
    dependencies {
	classpath "gradle.plugin.com.dorongold.plugins:task-tree:1.5"
    }
}
rootProject {
    apply plugin: com.dorongold.gradle.tasktree.TaskTreePlugin
}

Usage

gradle <task 1>...<task N> taskTree

When one of the tasks given to the gradle command is taskTree, execution of all the other tasks on that line is skipped. Instead, their task dependency tree is printed.

Examples

gradle build taskTree

:build
+--- :assemble
|    \--- :jar
|         \--- :classes
|              +--- :compileJava
|              \--- :processResources
\--- :check
     \--- :test
          +--- :classes
          |    +--- :compileJava
          |    \--- :processResources
          \--- :testClasses
               +--- :compileTestJava
               |    \--- :classes
               |         +--- :compileJava
               |         \--- :processResources
               \--- :processTestResources

gradle compileJava taskTree

:compileJava
No task dependencies

gradle taskTree javadoc test check

:javadoc
\--- :classes
     +--- :compileJava
     \--- :processResources

:test
+--- :classes
|    +--- :compileJava
|    \--- :processResources
\--- :testClasses
     +--- :compileTestJava
     |    \--- :classes
     |         +--- :compileJava
     |         \--- :processResources
     \--- :processTestResources

:check
\--- :test
     +--- :classes
     |    +--- :compileJava
     |    \--- :processResources
     \--- :testClasses
          +--- :compileTestJava
          |    \--- :classes
          |         +--- :compileJava
          |         \--- :processResources
          \--- :processTestResources

Configuration

When running the taskTree task from command-line, you can add the flag: --no-repeat.
This prevents sections of the tree from being printed more than once.
For a large task-tree it has the effect of reducing the size of output without loosing information.
To limit the depth of the printed tree add the command-line option: --task-depth <number>.

You may add a configuration block for taskTree in your build.gradle (or, in case you take the Init Script approach, your init.gradle). In the configuration block you can set:

  • noRepeat = true has the same effect as passing --no-repeat to taskTree at command-line.
  • impliesSubProjects = true in a multi-project, taskTree will print the task-tree of the current project only (the default is to print the task-tree of current and child projects). This can reduce the size of output.
  • taskDepth = <number> e.g: taskDepth = 3 limits the depth of the printed tree.
//optional configuration
taskTree{
    noRepeat = true  //do not print a sub-tree in the task-tree more than once
    impliesSubProjects = true  //do not print task-tree for child projects in a multi-project
    taskDepth = 3 // limit tree depth to 3. Equivalent to running with the --task-depth option.
}

Note:

In a multi-project, it is recommended to apply the plugin on the root project only. The taskTree task will automatically be added to child projects.
I.e. it is unnecessary to apply this plugin under allprojects or subprojects.

Version Compatibility

Gradle 2.3+
Java 1.7+

Acknowledgements

Some functionality is based on gradle-visteg plugin - a plugin that creates an image with a DAG representation of the task tree.

You can’t perform that action at this time.