Skip to content

Gradle project file operations

Gradle project file operations refers to the set of APIs and capabilities provided by the org.gradle.api.Project interface that allow build scripts to interact with the file system.^[600-developer-gradle-gradle-build.md]

File Location

Gradle utilizes the file() method to locate files within the project structure.^[600-developer-gradle-gradle-build.md] File paths specified using this method are resolved relative to the current project directory.^[600-developer-gradle-gradle-build.md]

File Copying

For copying files and directories, Gradle provides a robust API described by org.gradle.api.file.CopySpec.^[600-developer-gradle-gradle-build.md] This interface allows for detailed specification of copy operations, including filtering, renaming, and exclusion of files.

Directory Iteration

To iterate over directories, Gradle uses the FileTreeElement abstraction.^[600-developer-gradle-gradle-build.md] This allows build logic to traverse and process file trees efficiently, often used in conjunction with tasks that generate or modify source code.

  • Gradle
  • [[Gradle Build Script]]

Sources

^[600-developer-gradle-gradle-build.md]