Copy Spec
A set of specifications for copying files. This includes:
- source directories (multiples allowed)
- destination directory
- ANT like include patterns
- ANT like exclude patterns
- File relocating rules
- renaming rules
- content filters
def myCopySpec = project.copySpec {
into('webroot')
exclude('**/.data/**')
from('src/main/webapp') {
include '**/*.jsp'
}
from('src/main/js') {
include '**/*.js'
}
}
Content copied to clipboard
into
and exclude
specifications at the root level are inherited by the two child CopySpecs. Copy specs can be reused in other copy specs via with method. This enables reuse of the copy spec instances. def contentSpec = copySpec {
from("content") {
include "**/*.txt"
}
}
task copy(type: Copy) {
into "$buildDir/copy"
with contentSpec
}
Content copied to clipboard
See also
Inheritors
Functions
Link copied to clipboard
abstract fun dirPermissions(configureAction: Action<in ConfigurableFilePermissions>): CopyProcessingSpec
Link copied to clipboard
Link copied to clipboard
inline fun ContentFilterable.expand(vararg properties: Pair<String, Any?>, action: Action<in ExpandDetails>): ContentFilterable
Kotlin extension function for org.gradle.api.file.ContentFilterable.expand.
inline fun CopySpec.expand(vararg properties: Pair<String, Any?>, action: Action<in ExpandDetails>): CopySpec
Kotlin extension function for org.gradle.api.file.CopySpec.expand.
Link copied to clipboard
abstract fun filePermissions(configureAction: Action<in ConfigurableFilePermissions>): CopyProcessingSpec
Link copied to clipboard
abstract fun filesMatching(patterns: Iterable<String>, action: Action<in FileCopyDetails>): CopySpec
Configure the org.gradle.api.file.FileCopyDetails for each file whose path matches any of the specified Ant-style patterns.
Configure the org.gradle.api.file.FileCopyDetails for each file whose path matches the specified Ant-style pattern.
Link copied to clipboard
abstract fun filesNotMatching(patterns: Iterable<String>, action: Action<in FileCopyDetails>): CopySpec
Configure the org.gradle.api.file.FileCopyDetails for each file whose path does not match any of the specified Ant-style patterns.
Configure the org.gradle.api.file.FileCopyDetails for each file whose path does not match the specified Ant-style pattern.
Link copied to clipboard
Link copied to clipboard
inline fun <T : FilterReader> ContentFilterable.filter(vararg properties: Pair<String, Any?>): ContentFilterable
inline fun <T : FilterReader> ContentFilterable.filter(properties: Map<String, Any?>): ContentFilterable
fun <T : FilterReader> ContentFilterable.filter(filterType: KClass<T>, vararg properties: Pair<String, Any?>): ContentFilterable
fun <T : FilterReader> ContentFilterable.filter(filterType: KClass<T>, properties: Map<String, Any?>): ContentFilterable
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.
inline fun ContentFilterable.filter(filterType: KClass<out FilterReader>, vararg properties: Pair<String, Any?>): ContentFilterable
Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.file.ContentFilterable.filter.
Adds a content filter to be used during the copy.
inline fun CopySpec.filter(filterType: KClass<out FilterReader>, vararg properties: Pair<String, Any?>): CopySpec
Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.file.CopySpec.filter.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Returns the strategy to use when trying to copy more than one file to the same destination.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Gets the charset used to read and write files when filtering.
Link copied to clipboard
Tells if empty target directories will be included in the copy.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Specifies whether case-sensitive pattern matching should be used.
Link copied to clipboard
Link copied to clipboard
Specifies whether case-sensitive pattern matching should be used for this CopySpec.
Link copied to clipboard
Link copied to clipboard
The strategy to use when trying to copy more than one file to the same destination.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Specifies the charset used to read and write files when filtering.
Link copied to clipboard
Controls if empty target directories should be included in the copy.
Link copied to clipboard