|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.Copy
class Copy extends ConventionTask
Task for copying files. This task can also rename and filter files as it copies. The task implements org.gradle.api.tasks.copy.CopySpec CopySpec for specifying what to copy.
Examples:
task(mydoc, type:Copy) { from 'src/main/doc' into 'build/target/doc' } task(initconfig, type:Copy) { from('src/main/config') { include '**/*.properties' include '**/*.xml' filter(ReplaceTokens, tokens:[version:'2.3.1']) } from('src/main/languages') { rename 'EN_US_(*.)', '$1' } into 'build/target/config' exclude '**/*.bak', '**/CVS/' }
Field Summary | |
---|---|
CopyActionImpl |
copyAction
|
Constructor Summary | |
Copy(Project project, java.lang.String name)
|
|
Copy(Project project, java.lang.String name, FileVisitor testVisitor, DirectoryWalker testWalker)
|
Method Summary | |
---|---|
void
|
configureRootSpec()
|
CopySpec
|
exclude(java.lang.String excludes)
Adds an ANT style exclude pattern to the copy specification. |
CopySpec
|
filter(Map map, java.lang.Class filterType)
Adds a content filter to be used during the copy. |
CopySpec
|
filter(java.lang.Class filterType)
Adds a content filter to be used during the copy. |
CopySpec
|
from(java.lang.Object sourcePaths)
Specifies sources for a copy. |
CopySpec
|
from(java.lang.Object sourcePath, Closure c)
Specifies the source for a copy and creates a child CopySpec. |
CopySpec
|
from(java.lang.Iterable sourcePaths)
Specifies sources for a copy. |
CopySpec
|
from(java.lang.Iterable sourcePaths, Closure c)
Specifies sources for a copy and creates a child CopySpec which is configured with the Closure. |
java.io.File
|
getDestinationDir()
|
List
|
getLeafSyncSpecs()
|
CopySpec
|
getRootSyncSpec()
|
List
|
getSrcDirs()
|
static void
|
globalExclude(java.lang.String excludes)
Set the exclude patterns used by all Copy tasks. |
CopySpec
|
include(java.lang.String includes)
Adds an ANT style include pattern to the copy specification. |
CopySpec
|
into(java.lang.Object destDir)
Specifies the destination directory for a copy. |
CopySpec
|
remapTarget(Closure closure)
Maps a source file to a different relative location under the target directory. |
CopySpec
|
rename(java.lang.String sourceRegEx, java.lang.String replaceWith)
Renames files based on a regular expression. |
void
|
setCaseSensitive(boolean caseSensitive)
Set case sensitivity for comparisons. |
void
|
setDestinationDir(java.io.File destinationDir)
|
void
|
setSrcDirs(List srcDirs)
|
Methods inherited from class ConventionTask | |
---|---|
conv, conventionMapping, conventionMapping, conventionProperty, getConventionAwareHelper, getConventionMapping, setConventionAwareHelper, setConventionMapping |
Methods inherited from class DefaultTask | |
---|---|
leftShift, methodMissing, propertyMissing |
Methods inherited from class java.lang.Object | |
---|---|
hashCode, getClass, equals, toString, wait, wait, wait, notify, notifyAll |
Field Detail |
---|
CopyActionImpl copyAction
Constructor Detail |
---|
public Copy(Project project, java.lang.String name)
public Copy(Project project, java.lang.String name, FileVisitor testVisitor, DirectoryWalker testWalker)
Method Detail |
---|
public void configureRootSpec()
public CopySpec exclude(java.lang.String excludes)
public CopySpec filter(Map map, java.lang.Class filterType)
Filter parameters may be specified using groovy map syntax.
Examples:
filter(HeadFilter, lines:25, skip:2) filter(ReplaceTokens, tokens:[copyright:'2009', version:'2.3.1'])
public CopySpec filter(java.lang.Class filterType)
Examples:
filter(StripJavaComments) filter(com.mycompany.project.CustomFilter)
public CopySpec from(java.lang.Object sourcePaths)
public CopySpec from(java.lang.Object sourcePath, Closure c)
public CopySpec from(java.lang.Iterable sourcePaths)
public CopySpec from(java.lang.Iterable sourcePaths, Closure c)
public java.io.File getDestinationDir()
public List getLeafSyncSpecs()
public CopySpec getRootSyncSpec()
public List getSrcDirs()
public static void globalExclude(java.lang.String excludes)
Copy.globalExclude( '**/.svn/' )Note that there are no global excludes by default. Unlike CopySpec.exclude, this does not add a new exclude pattern, it sets (or resets) the exclude patterns. You can't use sequential calls to this method to add multiple global exclude patterns.
public CopySpec include(java.lang.String includes)
all files ending with 'jsp' (including subdirectories) **/*.jsp all files beginning with 'template_' in the level1/level2 directory level1/level2/template_* all files (including subdirectories) beneath src/main/webapp src/main/webapp/ all files beneath any CVS directory (including subdirectories) under src/main/java src/main/java/**/CVS/**If this method is not called, then all files beneath the source directory will be included. If this method is called, then a file must match at least one of the include patterns to be copied.
public CopySpec into(java.lang.Object destDir)
public CopySpec remapTarget(Closure closure)
public CopySpec rename(java.lang.String sourceRegEx, java.lang.String replaceWith)
Example:
rename '(.*)_OEM_BLUE_(.*)', '$1$2'would map the file 'style_OEM_BLUE_.css' to 'style.css'
public void setCaseSensitive(boolean caseSensitive)
public void setDestinationDir(java.io.File destinationDir)
public void setSrcDirs(List srcDirs)
Groovy Documentation