Copy
Copies files into a destination directory. This task can also rename and filter files as it copies. The task implements CopySpec for specifying what to copy.
Examples:
task copyDocs(type: Copy) {
from 'src/main/doc'
into 'build/target/doc'
}
//for Ant filter
import org.apache.tools.ant.filters.ReplaceTokens
//for including in the copy task
def dataContent = copySpec {
from 'src/data'
include '*.data'
}
task initConfig(type: Copy) {
from('src/main/config') {
include '**/*.properties'
include '**/*.xml'
filter(ReplaceTokens, tokens: [version: '2.3.1'])
}
from('src/main/config') {
exclude '**/*.properties', '**/*.xml'
}
from('src/main/languages') {
rename 'EN_US_(.*)', '$1'
}
into 'build/target/config'
exclude '**/*.bak'
includeEmptyDirs = false
with dataContent
}
Since
0.7
Inheritors
Properties
The extra properties extension in this object's extension container.
Functions
Kotlin extension function for org.gradle.api.file.ContentFilterable.expand.
Kotlin extension function for org.gradle.api.file.CopySpec.expand.
Kotlin extension function for org.gradle.api.tasks.AbstractCopyTask.expand.
Adds a content filter to be used during the copy. Multiple calls add additional filters to the filter chain. Each filter should implement FilterReader. Import org.apache.tools.ant.filters.* for access to all the standard Ant filters.
Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.file.ContentFilterable.filter.
Adds a content filter to be used during the copy.
Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.file.CopySpec.filter.
Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.tasks.AbstractCopyTask.filter.
CopySourceSpec.CopySpec.CopySpec with the given destination path.Looks up a service provided by Gradle for use in this task.
Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.Task.service.
Returns the extension of the specified type.
Returns the extension of the specified extensionType.