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
}
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.
Returns the extension of the specified type.
Returns the extension of the specified extensionType.