Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD

## org.gradle.api.file
[Java] Interface CopySpec

    org.gradle.api.tasks.util.PatternFilterable
      org.gradle.api.file.CopySpec
          org.gradle.api.file.CopySourceSpec
              org.gradle.api.file.ContentFilterable
                  org.gradle.api.file.CopyProcessingSpec

All Superinterfaces:
  PatternFilterable, CopySourceSpec, ContentFilterable, CopyProcessingSpec

    public interface CopySpec
    extends CopyProcessingSpec, CopySourceSpec, PatternFilterable

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

CopySpecs may be nested by passing a closure to one of the from methods. The closure creates a child CopySpec and delegates methods in the closure to the child. Child CopySpecs inherit any values specified in the parent. This allows constructs like:

     into('webroot')
     exclude('**/.svn/**')
     from('src/main/webapp') {
        include '**/*.jsp'
     }
     from('src/main/js') {
        include '**/*.js'
     }

In this example, the `into` and `exclude` specifications at the root level are inherited by the two child CopySpecs.

Authors:
  Steve Appling

See Also:
  Copy Task
  Project.copy

Method Summary
`CopySpec` | `eachFile(Action action)` {@inheritDoc}
`CopySpec` | `eachFile(groovy.lang.Closure closure)` {@inheritDoc}
`CopySpec` | `exclude(java.lang.String... excludes)` {@inheritDoc}
`CopySpec` | `exclude(java.lang.Iterable excludes)` {@inheritDoc}
`CopySpec` | `exclude(Spec excludeSpec)` {@inheritDoc}
`CopySpec` | `exclude(groovy.lang.Closure excludeSpec)` {@inheritDoc}
`CopySpec` | `expand(java.util.Map properties)` {@inheritDoc}
`CopySpec` | `filter(java.util.Map properties, java.lang.Class filterType)` {@inheritDoc}
`CopySpec` | `filter(java.lang.Class filterType)` {@inheritDoc}
`CopySpec` | `filter(groovy.lang.Closure closure)` {@inheritDoc}
`CopySpec` | `from(java.lang.Object... sourcePaths)` {@inheritDoc}
`CopySpec` | `from(java.lang.Object sourcePath, groovy.lang.Closure c)` {@inheritDoc}
`boolean` | `getIncludeEmptyDirs()` Tells if empty target directories will be included in the copy.
`CopySpec` | `include(java.lang.String... includes)` {@inheritDoc}
`CopySpec` | `include(java.lang.Iterable includes)` {@inheritDoc}
`CopySpec` | `include(Spec includeSpec)` {@inheritDoc}
`CopySpec` | `include(groovy.lang.Closure includeSpec)` {@inheritDoc}
`CopySpec` | `into(java.lang.Object destPath)` {@inheritDoc}
`CopySpec` | `into(java.lang.Object destPath, groovy.lang.Closure configureClosure)` Creates and configures a child `CopySpec` with the given destination path.
`boolean` | `isCaseSensitive()` Specifies whether case-sensitive pattern matching should be used.
`CopySpec` | `rename(groovy.lang.Closure closure)` {@inheritDoc}
`CopySpec` | `rename(java.lang.String sourceRegEx, java.lang.String replaceWith)` {@inheritDoc}
`CopyProcessingSpec` | `rename(java.util.regex.Pattern sourceRegEx, java.lang.String replaceWith)` {@inheritDoc}
`void` | `setCaseSensitive(boolean caseSensitive)` Specifies whether case-sensitive pattern matching should be used for this CopySpec.
`CopySpec` | `setExcludes(java.lang.Iterable excludes)` {@inheritDoc}
`void` | `setIncludeEmptyDirs(boolean includeEmptyDirs)` Controls if empty target directories should be included in the copy.
`CopySpec` | `setIncludes(java.lang.Iterable includes)` {@inheritDoc}
`CopySpec` | `with(CopySpec... sourceSpecs)` Adds the given specs as a child of this spec.

Methods inherited from interface PatternFilterable
exclude, exclude, exclude, exclude, getExcludes, getIncludes, include, include, include, include, setExcludes, setIncludes

Methods inherited from interface CopySourceSpec
from, from

Methods inherited from interface CopyProcessingSpec
eachFile, eachFile, getDirMode, getFileMode, into, rename, rename, rename, setDirMode, setFileMode

Methods inherited from interface ContentFilterable
expand, filter, filter, filter

Method Detail

### eachFile

    public CopySpec eachFile(Action action)

  {@inheritDoc}

### eachFile

    public CopySpec eachFile(groovy.lang.Closure closure)

  {@inheritDoc}

### exclude

    public CopySpec exclude(java.lang.String... excludes)

  {@inheritDoc}
  See Also:
    Pattern Format

### exclude

    public CopySpec exclude(java.lang.Iterable excludes)

  {@inheritDoc}
  See Also:
    Pattern Format

### exclude

    public CopySpec exclude(Spec excludeSpec)

  {@inheritDoc}
  See Also:
    Pattern Format

### exclude

    public CopySpec exclude(groovy.lang.Closure excludeSpec)

  {@inheritDoc}
  See Also:
    Pattern Format

### expand

    public CopySpec expand(java.util.Map properties)

  {@inheritDoc}

### filter

    public CopySpec filter(java.util.Map properties, java.lang.Class filterType)

  {@inheritDoc}

### filter

    public CopySpec filter(java.lang.Class filterType)

  {@inheritDoc}

### filter

    public CopySpec filter(groovy.lang.Closure closure)

  {@inheritDoc}

### from

    public CopySpec from(java.lang.Object... sourcePaths)

  {@inheritDoc}

### from

    public CopySpec from(java.lang.Object sourcePath, groovy.lang.Closure c)

  {@inheritDoc}

### getIncludeEmptyDirs

    public boolean getIncludeEmptyDirs()

  Tells if empty target directories will be included in the copy.
  Returns:
    `true` if empty target directories will be included in the copy, `false` otherwise

### include

    public CopySpec include(java.lang.String... includes)

  {@inheritDoc}
  See Also:
    Pattern Format

### include

    public CopySpec include(java.lang.Iterable includes)

  {@inheritDoc}
  See Also:
    Pattern Format

### include

    public CopySpec include(Spec includeSpec)

  {@inheritDoc}
  See Also:
    Pattern Format

### include

    public CopySpec include(groovy.lang.Closure includeSpec)

  {@inheritDoc}
  See Also:
    Pattern Format

### into

    public CopySpec into(java.lang.Object destPath)

  {@inheritDoc}

### into

    public CopySpec into(java.lang.Object destPath, groovy.lang.Closure configureClosure)

  Creates and configures a child `CopySpec` with the given destination path. The destination is evaluated as for Project.file.
  Parameters:
    `destPath` - Path to the destination directory for a Copy
    `configureClosure` - The closure to use to configure the child `CopySpec`.
  Returns:
    this

### isCaseSensitive

    public boolean isCaseSensitive()

  Specifies whether case-sensitive pattern matching should be used.
  Returns:
    true for case-sensitive matching.

### rename

    public CopySpec rename(groovy.lang.Closure closure)

  {@inheritDoc}

### rename

    public CopySpec rename(java.lang.String sourceRegEx, java.lang.String replaceWith)

  {@inheritDoc}

### rename

    public CopyProcessingSpec rename(java.util.regex.Pattern sourceRegEx, java.lang.String replaceWith)

  {@inheritDoc}

### setCaseSensitive

    public void setCaseSensitive(boolean caseSensitive)

  Specifies whether case-sensitive pattern matching should be used for this CopySpec.
  Parameters:
    `caseSensitive` - true for case-sensitive matching.

### setExcludes

    public CopySpec setExcludes(java.lang.Iterable excludes)

  {@inheritDoc}
  See Also:
    Pattern Format

### setIncludeEmptyDirs

    public void setIncludeEmptyDirs(boolean includeEmptyDirs)

  Controls if empty target directories should be included in the copy.
  Parameters:
    `includeEmptyDirs` - `true` if empty target directories should be included in the copy, `false` otherwise

### setIncludes

    public CopySpec setIncludes(java.lang.Iterable includes)

  {@inheritDoc}
  See Also:
    Pattern Format

### with

    public CopySpec with(CopySpec... sourceSpecs)

  Adds the given specs as a child of this spec.
  Parameters:
    `sourceSpecs` - The specs to add
  Returns:
    this

Groovy Documentation