In gradle.build
you can reference the buildDir
and use it as a source or destination. How can I reference the buildDir
of a subproject from the root build.gradle
file?
(And a similar supplementary question, how can I reference subprojects in a Copy task? I have tried ':subproject_name/some_directory' but it errors).
rootDir. The root directory of this project. The root directory is the project directory of the root project. rootProject. The root project for the hierarchy that this project belongs to.
Gradle uses the name build. gradle as the default name for a build file. If we write our build code in a file build. gradle then we don't have to specify the build filename when we run tasks.
A FileTree represents a hierarchy of files. It extends FileCollection to add hierarchy query and manipulation methods. You typically use a FileTree to represent files to copy or the contents of an archive. You can obtain a FileTree instance using Project.
project(':a-subproject').buildDir
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With