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 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 }
Type | Name and description |
---|---|
protected CopyAction |
createCopyAction() |
protected CopySpecInternal |
createRootSpec() |
File |
getDestinationDir() Returns the directory to copy files into. |
DestinationRootCopySpec |
getRootSpec() |
void |
setDestinationDir(File destinationDir) Sets the directory to copy files into. |
Methods inherited from class | Name |
---|---|
class AbstractCopyTask |
copy, createCopyAction, createRootSpec, eachFile, eachFile, exclude, exclude, exclude, exclude, expand, filesMatching, filesNotMatching, filter, filter, filter, from, from, getDirMode, getDuplicatesStrategy, getExcludes, getFileLookup, getFileMode, getFileResolver, getFileSystem, getIncludeEmptyDirs, getIncludes, getInstantiator, getMainSpec, getRootSpec, getSource, include, include, include, include, into, into, isCaseSensitive, rename, rename, rename, setCaseSensitive, setDirMode, setDuplicatesStrategy, setExcludes, setFileMode, setIncludeEmptyDirs, setIncludes, with |
Returns the directory to copy files into.
Sets the directory to copy files into. This is the same as calling into(Object) on this task.
destinationDir
- The destination directory. Must not be null.