abstract class A : DefaultTask() { @get:InputFile val from: Property = project.objects.property() @get:OutputFile val into: Property = project.objects.property() @TaskAction fun foo() { into.get().toFile().writeText(from.get().toFile().readText()) } } abstract class B : DefaultTask() { @get:InputFile abstract val from: RegularFileProperty @get:OutputFile abstract val into: RegularFileProperty @TaskAction fun foo() { val fromFile = from.asFile.get() check(fromFile.exists()) into.get().asFile.writeText(fromFile.readText()) } } val aTask = tasks.register("foo") { from.set(layout.projectDirectory.file("foo.txt").asFile.toPath()) into.set(layout.buildDirectory.file("bar.txt").get().asFile.toPath()) } val b = tasks.register("bar") { from.set(aTask.flatMap { it.into }) into.set(layout.buildDirectory.file("baz.txt").get().asFile.toPath()) }