# Implementing tasks with dependency resolution result inputs Sample

version 7.6.6-20250823033406+0000

- Groovy DSL

- Kotlin DSL

| You can open the samples inside an IDE using the IntelliJ native importer or Eclipse Buildship.

This sample shows how to create a plugin with tasks that have dependency resolution results as inputs. The plugin is packaged via an included build and is demonstrated on a multi-project build for a Java application.

settings.gradle

    includeBuild "dependency-reports"

    include "utilities"
    include "list"

list/build.gradle

    plugins {
        id "java-library"
    }

utilities/build.gradle

    plugins {
        id "java-library"
    }

    dependencies {
        api project(":list")
    }

build.gradle

    plugins {
        id "application"
        id "com.example.dependency-reports"
    }

    dependencies {
        constraints {
            implementation "org.apache.commons:commons-text:1.9"
        }
        implementation "org.apache.commons:commons-text"
        implementation project(":utilities")
    }

settings.gradle.kts

    includeBuild("dependency-reports")

    include("utilities")
    include("list")

list/build.gradle.kts

    plugins {
        id("java-library")
    }

utilities/build.gradle.kts

    plugins {
        id("java-library")
    }

    dependencies {
        api(project(":list"))
    }

build.gradle.kts

    plugins {
        id("application")
        id("com.example.dependency-reports")
    }

    dependencies {
        constraints {
            implementation("org.apache.commons:commons-text:1.9")
        }
        implementation("org.apache.commons:commons-text")
        implementation(project(":utilities"))
    }

To execute the sample tasks:

    > ./gradlew -q listResolvedArtifacts
    FILE commons-text-1.9.jar
      id: commons-text-1.9.jar (org.apache.commons:commons-text:1.9)
      variant: org.apache.commons:commons-text:1.9 configuration runtime
      size: 216211

    FILE utilities.jar
      id: utilities.jar (project :utilities)
      variant: configuration ':utilities:runtimeElements'
      size: 261

    FILE commons-lang3-3.11.jar
      id: commons-lang3-3.11.jar (org.apache.commons:commons-lang3:3.11)
      variant: org.apache.commons:commons-lang3:3.11 configuration runtime
      size: 577742

    FILE list.jar
      id: list.jar (project :list)
      variant: configuration ':list:runtimeElements'
      size: 261

    BUILD SUCCESSFUL in 1s
    1 actionable task: 1 executed

    > ./gradlew -q graphResolvedComponents
    project :
      org.apache.commons:commons-text -> org.apache.commons:commons-text:1.9
        org.apache.commons:commons-lang3:3.11 -> org.apache.commons:commons-lang3:3.11
      project :utilities -> project :utilities
        project :list -> project :list
      org.apache.commons:commons-text:1.9 -> org.apache.commons:commons-text:1.9 (already seen)

    BUILD SUCCESSFUL in 1s
    1 actionable task: 1 executed

    > ./gradlew -q graphResolvedComponentsAndFiles
    project :
      org.apache.commons:commons-text -> org.apache.commons:commons-text:1.9 => commons-text-1.9.jar
        org.apache.commons:commons-lang3:3.11 -> org.apache.commons:commons-lang3:3.11 => commons-lang3-3.11.jar
      project :utilities -> project :utilities => utilities.jar
        project :list -> project :list => list.jar
      org.apache.commons:commons-text:1.9 -> org.apache.commons:commons-text:1.9 => commons-text-1.9.jar (already seen)

    BUILD SUCCESSFUL in 1s
    1 actionable task: 1 executed

For more information, see Authoring Tasks reference chapter. More specifically, see the Incremental Build section and its Using dependency resolution results subsection.