Comparable<Task>
, ContentFilterable
, CopyProcessingSpec
, CopySourceSpec
, CopySpec
, org.gradle.api.internal.DynamicObjectAware
, org.gradle.api.internal.file.copy.CopySpecSource
, org.gradle.api.internal.IConventionAware
, org.gradle.api.internal.TaskInternal
, ExtensionAware
, Task
, PatternFilterable
, Configurable<Task>
ProcessResources
@DisableCachingByDefault(because="Not worth caching") public class Copy extends AbstractCopyTask
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 }
Task.Namer
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
Constructor | Description |
---|---|
Copy() |
Modifier and Type | Method | Description |
---|---|---|
protected org.gradle.api.internal.file.copy.CopyAction |
createCopyAction() |
|
protected org.gradle.api.internal.file.copy.CopySpecInternal |
createRootSpec() |
|
File |
getDestinationDir() |
Returns the directory to copy files into.
|
org.gradle.api.internal.file.copy.DestinationRootCopySpec |
getRootSpec() |
|
void |
ignoreExistingContentInDestinationDir() |
Force Gradle to ignore content in the destination directory.
|
void |
setDestinationDir(File destinationDir) |
Sets the directory to copy files into.
|
copy, createCopyActionExecuter, eachFile, eachFile, exclude, exclude, exclude, exclude, expand, expand, filesMatching, filesMatching, filesNotMatching, filesNotMatching, filter, filter, filter, filter, from, from, from, getDirectoryFileTreeFactory, getDirMode, getDocumentationRegistry, getDuplicatesStrategy, getExcludes, getFileLookup, getFileMode, getFileResolver, getFileSystem, getFilteringCharset, getIncludeEmptyDirs, getIncludes, getInstantiator, getMainSpec, getObjectFactory, getSource, include, include, include, include, into, into, into, isCaseSensitive, rename, rename, rename, rename, setCaseSensitive, setDirMode, setDuplicatesStrategy, setExcludes, setFileMode, setFilteringCharset, setIncludeEmptyDirs, setIncludes, with
conventionMapping, conventionMapping, getConventionMapping
compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService
appendParallelSafeAction, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getOnlyIf, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isEnabled, isHasCustomActions, prependParallelSafeAction, setImpliesSubProjects
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getConvention
protected org.gradle.api.internal.file.copy.CopyAction createCopyAction()
createCopyAction
in class AbstractCopyTask
protected org.gradle.api.internal.file.copy.CopySpecInternal createRootSpec()
createRootSpec
in class AbstractCopyTask
public org.gradle.api.internal.file.copy.DestinationRootCopySpec getRootSpec()
getRootSpec
in interface org.gradle.api.internal.file.copy.CopySpecSource
getRootSpec
in class AbstractCopyTask
@Incubating public void ignoreExistingContentInDestinationDir()
This can be useful if the destination directory contains unreadable content, or special files like named pipes that Gradle cannot snapshot. It can also be useful when copying to a location not exclusively owned by the build, for example to a common installation directory. In the latter case calling this method will prevent Gradle from trying to snapshot a potentially large amount of content (that might also contain unreadable files). Copy tasks which ignore content in the destination directory are never up-to-date.
Untracked
@OutputDirectory public File getDestinationDir()
public void setDestinationDir(File destinationDir)
AbstractCopyTask.into(Object)
on this task.destinationDir
- The destination directory. Must not be null.