gradle
8.6

# copySpec

abstract fun copySpec(@DelegatesTo(value = CopySpec::class) closure: Closure): CopySpec(source)

Creates a CopySpec which can later be used to copy files or create an archive. The given closure is used to configure the CopySpec before it is returned by this method.

    def baseSpec = copySpec {
       from "source"
       include "**/*.java"
    }

    task copy(type: Copy) {
       into "target"
       with baseSpec
    }

Content copied to clipboard

#### Return

The CopySpec

#### Parameters

closure

Closure to configure the CopySpec

abstract fun copySpec(action: Action<out Any>): CopySpec(source)

Creates a CopySpec which can later be used to copy files or create an archive. The given action is used to configure the CopySpec before it is returned by this method.

#### Return

The CopySpec

#### Parameters

action

Action to configure the CopySpec

#### See also

copySpec(Closure)

abstract fun copySpec(): CopySpec(source)

Creates a CopySpec which can later be used to copy files or create an archive.

#### Return

a newly created copy spec