For day-to-day build-related activities, Gradle provides a variety of tasks. We will take a look at some of Gradle's in-built tasks.
This task is used to copy file(s) or directories from one location to the other:
task copyTask(type: Copy) { from "." into "abc" include('employees.xml') }
In copyTask
, we have configured the from
location and into
location, and have also added the condition to include only employees.xml
.
This task is an extended version of the copy task, which is used to rename files or directories:
task copyWithRename(type: Copy) { from "." into "dir1" include('employees.xml') rename { String fileName -> fileName.replace("employees", "abc") } }
In the copyWithRename
task, an additional rename
closure was added.